设为首页 加入收藏

TOP

angular 获取ng-repeat完成状态 $last
2017-10-10 17:06:44 】 浏览:3985
Tags:angular 获取 ng-repeat 完成 状态 last

$index $first $middle $last $odd $even

html

<ul>
    <li ng-repeat="item in data" repeat-finish="renderFinish()">{{item.str}}</li>
</ul>

指令

app.directive('repeatFinish',function(){
    return {
        link: function(scope,element,attr){
            console.log(scope.$index)
            if(scope.$last == true){
                console.log('ng-repeat执行完毕')
                scope.$eva l( attr.repeatFinish )
            }
        }
    }
})

ctrl里面

//controller里对应的处理函数
$scope.renderFinish = function(){
    console.log('渲染完之后的操作')
}

 

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇javaScript 设计模式之中介者模式.. 下一篇threejs立方体贴图产生边缘锯齿问..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目