How to display ng-repeat
in a component as a table? Why is my item component not displaying data as table rows?
Here's a Plunker and the code as well:
index.html
<body ng-controller="MainCtrl as vm">
<table border="1">
<tbody>
<item data="name" ng-repeat="name in vm.names"></item>
</tbody>
</table>
</body>
item.html
<tr>
<td>{{$ctrl.data.first}}</td>
<td>{{$ctrl.data.family}}</td>
</tr>
app.js
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
var vm = this;
vm.names = [{family: "dela cruz", first: "juan"}, {family: "tamad", first: "juan"}]
});
angular.module('plunker').component('item', {
templateUrl: 'item.html',
bindings: {
data: '='
}
});