diff --git a/src/directive/ngRepeat.js b/src/directive/ngRepeat.js index efa271530df9..82f8b9c734c1 100644 --- a/src/directive/ngRepeat.js +++ b/src/directive/ngRepeat.js @@ -73,10 +73,10 @@ var ngRepeatDirective = ngDirective({ } lhs = match[1]; rhs = match[2]; - match = lhs.match(/^([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\)$/); + match = lhs.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/); if (!match) { throw Error("'item' in 'item in collection' should be identifier or (key, value) but got '" + - keyValue + "'."); + lhs + "'."); } valueIdent = match[3] || match[1]; keyIdent = match[2]; diff --git a/test/directive/ngRepeatSpec.js b/test/directive/ngRepeatSpec.js index 8b6a5173bc68..85aa151140c7 100644 --- a/test/directive/ngRepeatSpec.js +++ b/test/directive/ngRepeatSpec.js @@ -64,12 +64,19 @@ describe('ng-repeat', function() { })); - it('should error on wrong parsing of ng-repeat', inject(function($rootScope, $compile, $log) { + it('should error on wrong parsing of ng-repeat', inject(function($rootScope, $compile) { expect(function() { element = $compile('