[英]Can ng-repeat displays data based on a rule? *filter*
我有两个选择(多选/选择列表)。
我需要在两边都显示客户端,但是:
左侧的选择列表应仅在“ cliente”表中显示具有“ consultaNotasDestinadasAutomaticamente”字段为true的客户端。
右侧的选择列表应仅在“ cliente”表中显示具有“ consultaNotasDestinadasAutomaticamente”字段为false的客户端。
我怎样才能做到这一点?
这是我的html:
<div class="form group">
<label class="control-label col-md-3">Empresas:</label>
<select id="select1" name="select1" multiple="multiple">
<option ng-repeat="c in clientes" value="{{c.idCliente}}" ng-click="atribuirUm($index, c)">{{c.razaoSocial}}</option>
</select>
<label class="control-label col-md-3">Empresas:</label>
<select ng-model="listaEmpresas" id="select2" name="select2" multiple="multiple">
<option selected="selected" ng-repeat="c2 in clientes2" value="{{c2.idCliente}}" ng-click="limparUm($index, c2)">{{c2.razaoSocial}}</option>
</select>
</div>
您可以使用管道|
将数据传递到过滤器
ng-repeat="c in clients | filter:{consultaNotasDestinadasAutomaticamente: true}"
实际上,您可以根据需要通过管道传递任意数量的内置过滤器和自定义过滤器,即
ng-repeat="c in clients | filter:{consultaNotasDestinadasAutomaticamente: true} | limitTo:4 | json"
筛选器文档: https : //docs.angularjs.org/api/ng/filter
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.