您的位置:首页 > Web前端 > AngularJS

angularJS如何在页面生成之后再执行其他的js脚本代码

2016-09-26 10:26 281 查看
js文件:

app.directive('onFinishRenderFilters', function($timeout) {

return {
restrict:'A',//以属性的形式应用(E 作为元素名使用,A 作为属性使用,C 作为类名使用,M 作为注释使用)
link : function(scope, element, attr) {
if (scope.$last === true) {
$timeout(function() {
scope.$emit('hideElement');
});
}
}
};

});

$scope.$on('hideElement', function(hideElement) {
$(".dellabel").hide();
});

HTML文件:

<a ng-click="show(t.task_id)" class="tablelink dellabel"  on-finish-render-filters> 删除</a>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: