zoukankan      html  css  js  c++  java
  • AngularJs学习之一使用自定义的过滤器

    script:
    
    参数item是由AngularJs提供的,是应当被过滤的对象集合。而showComplete是我们传入的参数。
    
    {{item.action}}
    
    用ng-model创造一个名为showComplete的数据
    
    script:
    
    <script type="text/javascript">// <![CDATA[
    todoApp.filter("checkedItems",function(){
        return function (items,showComplete){
        var resultArr =[];
        angular.forEach(items,function(item){
        if(item.done==false||showComplete==true){
        resultArr.push(item);
        }
        });
        return resultArr;
        }
    });
    //</script>
    
    <p>参数item是由AngularJs提供的,是应当被过滤的对象集合。而showComplete是我们传入的参数。</p>
    <p>{{item.action}}</p>

    <tr ng-repeat="item in todo.items|checkedItems:showComplete|orderBy:'action'">
    <td>{{item.action}}</td>
    </tr>

    
    用ng-model创造一个名为showComplete的数据模型值。
    <lable><input type="checkbox" ng-model="showComplete">show complete</input></lable>
    
      
    
    show complete
  • 相关阅读:
    Teamwork[HDU4494]
    The Parallel Challenge Ballgame[HDU1101]
    「JSOI2016」无界单词
    「SCOI2015」小凸玩密室
    #3636. IIIDX(iiidx)
    #2652. 背单词(word)
    「JXOI2017」加法
    拙者
    19.10.01 acm E:Lowest Common Ancestor
    #3391. big
  • 原文地址:https://www.cnblogs.com/yansum/p/5813741.html
Copyright © 2011-2022 走看看