我是新的Angular JS和我试图创建一个自定义指令,将使用如下:
原文链接:https://www.f2er.com/angularjs/146623.html< div linkedlist listcolumns =“{{cashAccountsColumns}}”>< / div>
Corrps。控制器将:
$scope.cashAccountsColumns = [ {"field": "description","title": "Description"},{"field": "owner","title":"Owner"},{"field": "currentBalance","title":"Current Balance" } ];@H_403_6@指令代码是:
return { restrict : 'EA',transclude : false,templateUrl : 'html/linkedlist.html',scope: { listcolumns: "@" },link : function(scope,element,attrs) { } }@H_403_6@模板是:
<table class="Box-table" width="100%"> <thead> <tr> <th scope="col" ng-repeat="column in listcolumns"> {{column.title}} </th> </tr> </thead> </table>@H_403_6@但这不工作。我没有得到column.title的值在屏幕上,太多的行如下被添加到DOM:
<th ng-repeat="column in listcolumns" scope="col" class="ng-scope ng-binding"></th>@H_403_6@