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
This commit is contained in:
Igor Minar
2012-01-05 23:03:45 -08:00
parent 1dccaaaaa2
commit cd9a7b9608
3 changed files with 34 additions and 3 deletions

View File

@@ -429,6 +429,14 @@ describe('widget', function() {
expect(element.text()).toBe('a|b|||c||d|');
}));
it('should iterate over all kinds of types', inject(function($rootScope, $compile) {
var element = $compile('<ul><li ng:repeat="item in array">{{item}}|</li></ul>')($rootScope);
$rootScope.array = ['a', 1, null, undefined, {}];
$rootScope.$digest();
expect(element.text()).toMatch(/a\|1\|\|\|\{\s*\}\|/);
}));
describe('stability', function() {
var a, b, c, d, lis, element;