mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-27 15:04:02 +00:00
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:
parent
7146f70636
commit
614fd3d55a
1 changed files with 8 additions and 0 deletions
|
|
@ -501,6 +501,14 @@ describe('widget', function() {
|
||||||
expect(element.text()).toBe('a|b|||c||d|');
|
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()).toBe('a|1|||{\n }|');
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
it('should iterate over all kinds of types', inject(function($rootScope, $compile) {
|
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);
|
var element = $compile('<ul><li ng:repeat="item in array">{{item}}|</li></ul>')($rootScope);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue