我有以下指令传递事件参数的自定义指令
.directive('uiBlur', function() {
return function(scope, elem, attrs) {
elem.bind('blur', function() {
scope.$apply(attrs.uiBlur);
});
};
})
这是HTML
<input id="mainOdd1Id" type="number" ng-model="data.mainOdd1" placeholder="#1 Main Odd" onfocus="this.placeholder=''" min="0" step="any" ui-Blur="testfn('data.mainOdd1', $event, '#1 Main Odd');">
而且这是在控制器的功能
$scope.testfn = function(propertyName, $event, placeHolder){
alert(propertyName);
}
我看到调试器$ event是未定义的...
这里有什么问题?
感谢
试试这个,NG-点击=“MYFUNC( 'data.mainOdd1',{$事件:$事件},”#1 Main Odd') –