diff --git a/src/ng/directive/ngController.js b/src/ng/directive/ngController.js index 7ee7648f0e37..322df0e73e71 100644 --- a/src/ng/directive/ngController.js +++ b/src/ng/directive/ngController.js @@ -164,6 +164,7 @@ var ngControllerDirective = [function() { return { scope: true, - controller: '@' + controller: '@', + priority: 500 }; }]; diff --git a/test/ng/directive/ngControllerSpec.js b/test/ng/directive/ngControllerSpec.js index 402ddf0901b1..8b5c59bd36b2 100644 --- a/test/ng/directive/ngControllerSpec.js +++ b/test/ng/directive/ngControllerSpec.js @@ -85,4 +85,26 @@ describe('ngController', function() { $rootScope.$digest(); expect(element.text()).toBe('Vojta'); })); + + it('should allow mixing with ngRepeat which inherits the item sub-scope', inject(function($compile, $rootScope){ + $rootScope.Counter = function($scope){ + $scope.count = $scope.$index; + }; + + element = $compile('
{{count}};
')($rootScope); + $rootScope.$digest(); + expect(element.text()).toBe('0;1;'); + })); + + it('should allow mixing with ngInclude', inject(function($compile, $rootScope, $httpBackend) { + $rootScope.Includer = function($scope) { + $scope.name = 'Included'; + }; + element = $compile('
')($rootScope); + $httpBackend.expect('GET', 'url').respond('{{name}}'); + $rootScope.$digest(); + $httpBackend.flush(); + expect(element.text()).toEqual('Included'); + dealoc($rootScope); + })); });