Permalink
Browse files
fix(ngRepeat): allow extra whitespaces in (key,value) part of micro-s…
…yntax
e.g. ( aaa , bbb ) will be accepted by parser
Fixes #6827
Closes #6833
- Loading branch information
Showing
with
11 additions
and
1 deletion.
-
+1
−1
src/ng/directive/ngRepeat.js
-
+10
−0
test/ng/directive/ngRepeatSpec.js
|
|
@@ -257,7 +257,7 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) { |
|
|
var aliasAs = match[3]; |
|
|
var trackByExp = match[4]; |
|
|
|
|
|
match = lhs.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/); |
|
|
match = lhs.match(/^(?:(\s*[\$\w]+)|\(\s*([\$\w]+)\s*,\s*([\$\w]+)\s*\))$/); |
|
|
|
|
|
if (!match) { |
|
|
throw ngRepeatMinErr('iidexp', "'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'.", |
|
|
|
|
|
@@ -146,6 +146,16 @@ describe('ngRepeat', function() { |
|
|
expect(element.text()).toEqual('misko:swe|shyam:set|'); |
|
|
}); |
|
|
|
|
|
it('should iterate over on object/map where (key,value) contains whitespaces', function() { |
|
|
element = $compile( |
|
|
'<ul>' + |
|
|
'<li ng-repeat="( key , value ) in items">{{key}}:{{value}}|</li>' + |
|
|
'</ul>')(scope); |
|
|
scope.items = {me:'swe', you:'set'}; |
|
|
scope.$digest(); |
|
|
expect(element.text()).toEqual('me:swe|you:set|'); |
|
|
}); |
|
|
|
|
|
it('should iterate over an object/map with identical values', function() { |
|
|
element = $compile( |
|
|
'<ul>' + |
|
|
|