diff --git a/src/ng/directive/ngRepeat.js b/src/ng/directive/ngRepeat.js index aeb0fb8ecf00..6e1082cda1a3 100644 --- a/src/ng/directive/ngRepeat.js +++ b/src/ng/directive/ngRepeat.js @@ -338,7 +338,7 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) { // if object, extract keys, sort them and use to determine order of iteration over obj props collectionKeys = []; for (var itemKey in collection) { - if (collection.hasOwnProperty(itemKey) && itemKey.charAt(0) != '$') { + if (collection.hasOwnProperty(itemKey) && !(itemKey.charAt(0) === '$' && itemKey.charAt(1) === '$')) { collectionKeys.push(itemKey); } } diff --git a/test/ng/directive/ngRepeatSpec.js b/test/ng/directive/ngRepeatSpec.js index b9a0870f9c48..a5e71e7454b5 100644 --- a/test/ng/directive/ngRepeatSpec.js +++ b/test/ng/directive/ngRepeatSpec.js @@ -146,6 +146,16 @@ describe('ngRepeat', function() { expect(element.text()).toEqual('misko:swe|shyam:set|'); }); + it('should iterate over an object/map and not strip keys that begin with $', function() { + element = $compile( + '')(scope); + scope.items = {'$1 - $10':'low price', '$11 - $20':'high price'}; + scope.$digest(); + expect(element.text()).toEqual('$1 - $10:low price|$11 - $20:high price|'); + }); + it('should iterate over an object/map with identical values', function() { element = $compile( '