Javascript ng repeat是否可以根据规则显示数据*滤器*
我有两个选择(多选/选择列表) 我需要在两侧显示客户端,但是:Javascript ng repeat是否可以根据规则显示数据*滤器*,javascript,angularjs,Javascript,Angularjs,我有两个选择(多选/选择列表) 我需要在两侧显示客户端,但是: 左侧的选择列表应仅显示在“cliente”表中“consultaNotasDestinadasAutomaticamente”字段为true的客户端 右侧的选择列表应仅显示“cliente”表中此字段“consultaNotasDestinadasAutomaticamente”为false的客户端 我该怎么做 下面是我的html: <div class="form group"> <l
- 左侧的选择列表应仅显示在“cliente”表中“consultaNotasDestinadasAutomaticamente”字段为true的客户端
- 右侧的选择列表应仅显示“cliente”表中此字段“consultaNotasDestinadasAutomaticamente”为false的客户端
<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>
Empresas:
{{c.razaoSocial}}
Empresas:
{{c2.razaoSocial}}
您可以使用管道|
将数据传递到过滤器
ng-repeat="c in clients | filter:{consultaNotasDestinadasAutomaticamente: true}"
实际上,您可以根据需要通过管道传输任意数量的内置过滤器和自定义过滤器,即
ng-repeat="c in clients | filter:{consultaNotasDestinadasAutomaticamente: true} | limitTo:4 | json"
筛选文档:ng show/ng hide是另一个选项,如果您不介意将内容放到浏览器中以便以后显示
ng repeat=“c in clients | filter:{consultantosdestinadasuatomaticatione:true}”
您可以构造这样的东西为什么不将其作为答案发布@maurycy?maurycy,拜托,如果我接收的是对象而不是集合,我该怎么办?因为我得到了这个:“错误:过滤器:notarray不是数组”