【问题标题】:I want to create custom filter,when true, data.status: 'yes' only repeat,when false, 'yes' and ' no' repeat by using custom filter我想创建自定义过滤器,当为真时,data.status:“是”仅重复,当为假时,“是”和“否”通过使用自定义过滤器重复
【发布时间】:2015-09-01 20:27:49
【问题描述】:

demo

我想创建自定义过滤器,当为 true 时,data.status: 'yes' 只重复,当 false 时,'yes' 和 'no' 使用自定义过滤器重复

<body ng-app="myApp">
 <div ng-controller="SampleController as c">
 <input type="checkbox" name="check" ng-model="checked">
 <label for="check" ng-init="checked=true">only yes , toggle yes & no</label>
 <div>filter list </div>
 <div>
  <div>from get ServiceFunction</div>
  <ul>
    <li ng-if="checked" ng-repeat="fafa in c.getedService.data">
      <!-- Service list-->
      {{fafa.namae}}
      </li>
     </ul>
    </div>
  </div>
</body>

【问题讨论】:

标签: angularjs angularjs-ng-repeat angular-filters


【解决方案1】:

在使用 ng-model 时只是一个小拼写错误,您使用 mg-model 而不是 ng-modelHere 是工作的密码笔。

【讨论】:

  • 非常感谢您。我没注意到。我的下一个问题,财产。 data.status 在 false 时为 no,当为 true 时,我想显示 key'yes' &' no' 的值来查看谢谢
  • 也许我必须使用 lodash.js??
猜你喜欢
  • 2019-04-04
  • 2018-05-06
  • 2015-09-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-07-12
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多