向angular指令传参

https://segmentfault.com/q/1010000005837178


var demo = angular.module('demo', []);

demo.directive('ngTable', function(){

return {
restrict: 'E',
scope: {
data: '='
},
link: function($scope, element, attrs){
},
template: '
{{ item.id }}{{ item.name }}
'
};
});


demo.controller('DemoCtrl', function($scope){
$scope.list = [
{
id: 123,
name: 'Hello World'
},{
id: 234,
name: 'Fucking world'
},{
id: 345,
name: 'What did you say?'
}
];
});

你可能感兴趣的:(web前端)