码迷,mamicode.com
首页 > Web开发 > 详细

AngularJS监听DOM加载完毕

时间:2016-08-03 23:45:34      阅读:372      评论:0      收藏:0      [点我收藏+]

标签:

直接上代码:

Module.directive(‘renderFinish‘, function ($timeout) {      //renderFinish自定义指令
    return {
        restrict: ‘A‘,
        link: function(scope, element, attr) {
            if (scope.$last === true) {
                $timeout(function() {
                    scope.$emit(‘ngRepeatFinished‘);
                });
            }
        }
    };
});
/* 控制器 */
nassModule.controller(‘mallHome‘, [‘$scope‘, ‘$http‘, function($scope, $http) {

    $scope.$on(‘ngRepeatFinished‘, function(){
        $scope.funName();
    });

}]);

 

<li ng-repeat="item in data.focus" render-finish>content</li>

 

AngularJS监听DOM加载完毕

标签:

原文地址:http://www.cnblogs.com/jach/p/5734964.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!