// см. Этот пример кода, чтобы понять, как использовать директивы
// directive example
angular.module('thermofluor').directive('tablePlate', function(){
return {
restrict: 'E',
scope: {
arrayOfChecks: '='
},
template: '<h1>TEST</h1>' + htmlTable,
link: function(scope, element, attrs, ctrl){
}
}
});
var htmlTable =
'<table>' +
' <tr>' +
' <th>Name</th>' +
' <th>Value</th>' +
' <th>Active</th>' +
' </tr>' +
' <tr ng-repeat="c in arrayOfChecks">' +
' <td>{{c.name}}</td>' +
' <td>{{c.value</td>' +
' <td><input type="checkbox" ng-model="c.active"></td>' +
' </tr>' +
'</table>';
// controller
angular.module('thermofluor').controller('myController', function(){
$scope.myListOfChecks = [{name: 'A', value:'A value', active: false},
{name: 'B', value:'B value', active: true},
{name: 'C', value:'C value', active: false},
{name: 'D', value:'D value', active: true}];
});
// html
<div class="row" ng-controller="myController">
<table-plate array-of-checks="myListOfChecks"></table-plate>
</div>