我想将我的数据表的一列链接到动态 Angularjs 视图。
Table 1 :
ID | Name | Action
1 | Jack | Edit
编辑应该是指向 #/clients/1/edit 的链接
/clients/:id/edit (app.client_edit) 已经创建并且正在工作。
我正在尝试下面的代码:
$scope.dataTableOpt = {
"columnDefs": [
{
"targets": 0,
"render": function ( data ) {
return "<a ui-sref=\"app.client_view({id: $row[0]})\">Edit</a>";
}
}
],
'ajax': 'http://localhost/admin/clients'
};
给定结果:
Link1 = < a ui-sref="app.client_view({'id': '1'})">edit</ a>
预期结果:
Link2 = < a ui-sref="app.client_view({id: '1'})" class="ng-scope" href="#!/client/2">edit</ a>
当我< a ui-sref="app.client_view({'id': '1'})">test< / a>
静态放置页面时它正在工作,但不确定为什么它在动态生成时不起作用。
请指教。