angularjs如何在视图渲染结束之后,或者render之后执行指令中的link方法呢?

时间:2022-02-20 04:13:47

angularjs如何在视图渲染结束之后,或者render之后执行指令中的link方法

关键字:

$timeout

app.directive("myDirective",function($timeout){
return{
restrict:"A",
link:function(scope,element,attrs,accordionController){
$timeout(function(){
element.click(function(){
alert("hello);
});
},0);
}
}
});