mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-01-12 22:45:52 +08:00
fix(ngRepeat): allow extra whitespaces in (key,value) part of micro-syntax
e.g. ( aaa , bbb ) will be accepted by parser Fixes #6827 Closes #6833
This commit is contained in:
committed by
Pawel Kozlowski
parent
081fef60b2
commit
ef640cbc2a
@@ -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>' +
|
||||
|
||||
Reference in New Issue
Block a user