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

Commit 614fd3d

Browse files
IgorMinarmhevery
authored andcommitted
fix(ng:repeat): support repeating over array with null
typeof null == 'object', but it doesn't behave like an object because its properties can't be dereferenced, so we need to special-case it. Closes #702
1 parent 7146f70 commit 614fd3d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/widgetsSpec.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,14 @@ describe('widget', function() {
501501
expect(element.text()).toBe('a|b|||c||d|');
502502
}));
503503

504+
it('should iterate over all kinds of types', inject(function($rootScope, $compile) {
505+
var element = $compile('<ul><li ng:repeat="item in array">{{item}}|</li></ul>')($rootScope);
506+
$rootScope.array = ['a', 1, null, undefined, {}];
507+
$rootScope.$digest();
508+
509+
expect(element.text()).toBe('a|1|||{\n }|');
510+
}));
511+
504512

505513
it('should iterate over all kinds of types', inject(function($rootScope, $compile) {
506514
var element = $compile('<ul><li ng:repeat="item in array">{{item}}|</li></ul>')($rootScope);

0 commit comments

Comments
 (0)