odwl
odwl

Reputation: 2123

ng-repeat is only working to iterate over List and not Iterable or Set

It seems to be impossible to iterate over anything else than List with ng-repeat.

For instance, strangely the following code does not work:

<span ng-repeat="i in [1, 2, 3].toSet()>{{i}}</span>

The exception is thrown at package:angular/directive/ng_repeat.dart:126:8:

type '_LinkedHashSet' is not a subtype of type 'List'

It seems very restrictive to limit the ng-repead to proper List. It that possible to have ng-repeat iterating over any iterable and not just List.

Oliver

Upvotes: 3

Views: 887

Answers (1)

pavelgj
pavelgj

Reputation: 2701

It is a known limitation (https://github.com/angular/angular.dart/issues/292), mainly because ng-repeat relies on [] operator, which Iterable does not support. That said, angular could internally convert Iterable to List, making it easier for the user.

Upvotes: 3

Related Questions