1 回答

TA貢獻(xiàn)1995條經(jīng)驗(yàn) 獲得超2個(gè)贊
var app = angular.module('myApp',[]);
app.controller('myCtrl',function($scope){
$scope.accept= function(){
...
}
}
app.directive('myDir',
function(){
return {
restrict:'EA',
replace: true,
template: '<input ng-click="test()"></input>',
scope:{
test: '&'
},
link: function(scope, element, attrs) {
元素.bind("click",function(){
scope.accept();
})
}
}
}
);
你看看可不可以這樣子弄
添加回答
舉報(bào)