常用AngularJs代码段

前端之家收集整理的这篇文章主要介绍了常用AngularJs代码段前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。


一,ng-repeat/filter/orderby使用


数据结构:


{
    "result":true,"ItemWeekIndex":"第二周","Content":[
        {
            "weekIndex":1,"courseInfo":"11教501高等数学","periodTimesIndex":1
        },{
            "weekIndex":1,"courseInfo":"11教232大学英语(一)","periodTimesIndex":2
        },"courseInfo":"11教232食品安全学","periodTimesIndex":4
        },{
            "weekIndex":2,"courseInfo":"11教232乳制品工艺学","courseInfo":"11教232大学英语(二)","courseInfo":"11教232计算机基础(一)",{
            "weekIndex":3,"courseInfo":"11教234人体解剖学","courseInfo":"11教234植物资源学","periodTimesIndex":3
        },"courseInfo":"11教234花卉栽培技术",{
            "weekIndex":4,"courseInfo":"11教234植物衰老生物学",{
            "weekIndex":5,"courseInfo":"11教234文献检索","periodTimesIndex":3
        }
    ]
}


其中 ,content内放到是本周课表:weekIndex是周几,periodTimesIndex是第几节课,现在筛选本周每天第一节课,并按照顺序weekIndex排列:


<div class="col" ng-repeat="FirstLesson in weekLesson.Content | filter:{periodTimesIndex:1}:false | orderBy:weekIndex">{{FirstLesson.courseInfo}}</div>
原文链接:https://www.f2er.com/angularjs/149729.html

猜你在找的Angularjs相关文章