AngularDart ng-repeat in tables?
Only table tags (td, th, tr, tbody...) inside of <table>
tag are shown, you should add ng-repeat to <tr>
If you use angular1.2 or higher you can use ng-repeat-start
and ng-repeat-end
tags:
html:
<table ng-controller="apiCtrl"> <tr ng-repeat-start="item in foo" ng-init="first=item[0]"> <td>first: {{ first }}</td> </tr> <tr ng-repeat-end ng-init="last = item[1]"> <td>last: {{ last }}</td> </tr></table>
js:
function apiCtrl($scope) { $scope.foo = [ ['one', 'uno'], ['two', 'dos'], ['three', 'tres'] ];}
Here is JSfiddle
Here is fiddle with nested lists
This question is really old and AngularDart has changed a lot in the meantime. We can use the <ng-container>
tag to apply all kinds of directives to a group of tags which are to be repeated or put under an *ngIf
and so forth. The <ng-container>
tag will not appear in the DOM output, but its contents will be there and affected by the specified directive.
<table> <ng-container *ngFor="let row of matrix"> <tr> <ng-container *ngFor="let value of row"> <td>{{value}}</td> </ng-container> <tr> </ng-container></table>
When your component.dart has:
List<List<int>> get matrix => [[1, 2, 3], [4, 5, 6]];