【发布时间】:2014-04-07 04:30:56
【问题描述】:
我定义了以下指令:
app.directive('copyExpenditure', function(){
return {
restrict: 'A',
scope: true,
template: '<button ng-click="copyExpenditure()">click me</button>'
}
});
如果我将此指令直接添加到 html 中,它会按预期工作。
<div copy-expenditure></div>
现在我正在从控制器中创建一个网格,并希望将 copyExpenditure 指令动态添加到每一行。对于这个任务,我使用Slickgrid and a custom Formatter。
var LinkFormatter = function (row, cell, value, columnDef, dataContext) {
var tag = '<div copy-expenditure></div>';
return tag;
}
但似乎此自定义格式化程序并未呈现为指令,而仅呈现为 HTMl。知道该怎么做吗?我的目标只是使用ng-click 和LinkFormatter 呈现的标签调用作用域函数。
【问题讨论】: