diff --git a/src/ngRoute/directive/ngView.js b/src/ngRoute/directive/ngView.js index d67d8a76d53e..27357962a021 100644 --- a/src/ngRoute/directive/ngView.js +++ b/src/ngRoute/directive/ngView.js @@ -223,7 +223,7 @@ function ngViewFactory( $route, $anchorScroll, $compile, $controller, currentScope[current.controllerAs] = controller; } clone.data('$ngControllerController', controller); - clone.contents().data('$ngControllerController', controller); + clone.children().data('$ngControllerController', controller); } link(currentScope); diff --git a/test/ngRoute/directive/ngViewSpec.js b/test/ngRoute/directive/ngViewSpec.js index d354a3559ee1..d38b3ba95558 100644 --- a/test/ngRoute/directive/ngViewSpec.js +++ b/test/ngRoute/directive/ngViewSpec.js @@ -455,7 +455,7 @@ describe('ngView', function() { }); - it('should set $scope and $controllerController on the view', function() { + it('should set $scope and $controllerController on the view elements (except for non-element nodes)', function() { function MyCtrl($scope) { $scope.state = 'WORKS'; $scope.ctrl = this; @@ -466,11 +466,14 @@ describe('ngView', function() { }); inject(function($templateCache, $location, $rootScope, $route) { - $templateCache.put('tpl.html', [200, '