在我的指令中,我有一个带有 ng-repeat 的模板,
...return {
template:'<div id="wrapper"><ul><li ng-repeat="item in items">{{item.name}}</li></ul></div>',
compile:function (tElement, tAttrs) {
return function (scope, iElement, iAttrs) {
//bind item mouse event to a closure function
}
}
}...
我想将转发器的每个元素与指令中的函数绑定,最好的方法是什么?