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
  • 相关阅读:
    写在noi之前
    雅礼集训 Day8
    雅礼集训 Day6
    雅礼集训 Day5
    2017雅礼集训 Day4
    2017雅礼集训 Day2
    2017雅礼集训 Day1
    洛谷 P3426 [POI2005]SZA-Template
    Codeforces Round #368 DIV2 C.
    Educational Codeforces Round 16 D&E.
  • 原文地址:https://www.cnblogs.com/yansum/p/5813741.html
Copyright © 2011-2022 走看看