Angular: Table with ng:repeat
http://angularjs.org/
by TheFiddler
HTML
<script type="text/javascript" ng:autobind src="http://code.angularjs.org/0.10.5/angular-0.10.5.js"></script>
<table>
<tbody ng:repeat="i in items">
<tr>
<td>{{i.name}}</td><td>{{$index}}</td>
<td><button ng:click="addExample(i)">ADD</button></td>
</tr>
<tr ng:repeat="e in i.examples"><td>{{e.name}}</td><td>{{$index}}</td><td></td></tr>
</tbody>
</table>
JavaScript
function Main() {
this.items = [{
name: 'first',
examples: [
{name: 'first sub1'},
{name: 'first sub2'}
]},{
name: 'second',
examples: [
{name: 'second sub1'},
{name: 'second sub2'}
]}
];
this.addExample = function(item) {
item.examples.push({name: 'new item'});
};
}