标签:rect 初始化 single 瀑布流 example ast === col var
先定义指令:
app.directive(‘onFinishRender‘,function ($timeout) { return { restrict: ‘A‘, link: function (scope, element, attr) { if (scope.$last === true) { $timeout(function () { scope.$emit(‘ngRepeatFinished‘); // scope.isSelectShow = false; }); } } } });
然后再在控制器中进行监听,并调用初始化函数
$scope.$on(‘ngRepeatFinished‘, function(ngRepeatFinishedEvent) { var select = document.getElementById(‘mySelect‘); console.log(select); select.style ="width:100%;height:34px"; $(".js-example-basic-single").select2(); });
然后再在Html页面绑定:
<tbody ng-repeat="row in convertdisplayed|filter:filter |paging:page.index:page.size"
on-finish-render="ngRepeatFinished">
NG循环结束后执行函数:(用于瀑布流,下拉框,及相关需要插座dom插件之类的场景)
标签:rect 初始化 single 瀑布流 example ast === col var
原文地址:https://www.cnblogs.com/vonson/p/9330790.html