Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Repeater fix #606

Merged
merged 1 commit into from
Oct 19, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ angularWidget('@ng:repeat', function(expression, element){
cursor = iterStartElement; // current position of the node

for (key in collection) {
if (collection.hasOwnProperty(key)) {
if (collection.hasOwnProperty(key) && key.charAt(0) != '$') {
last = lastOrder.shift(value = collection[key]);
if (last) {
// if we have already seen this object, then we need to reuse the
Expand Down
22 changes: 22 additions & 0 deletions test/widgetsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,28 @@ describe("widget", function() {
expect(element.text()).toEqual('misko:m:first|shyam:s:last|');
});

it('should ignore $ and $$ properties', function() {
var scope = compile('<ul><li ng:repeat="i in items">{{i}}|</li></ul>');
scope.items = ['a', 'b', 'c'];
scope.items.$$hashkey = 'xxx';
scope.items.$root = 'yyy';
scope.$digest();

expect(element.text()).toEqual('a|b|c|');
});

it('should repeat over nested arrays', function() {
var scope = compile('<ul>' +
'<li ng:repeat="subgroup in groups">' +
'<div ng:repeat="group in subgroup">{{group}}|</div>X' +
'</li>' +
'</ul>');
scope.groups = [['a', 'b'], ['c','d']];
scope.$digest();

expect(element.text()).toEqual('a|b|Xc|d|X');
});


describe('stability', function() {
var a, b, c, d, scope, lis;
Expand Down