angularjs如何使用多个其他过滤器过滤整数的真值?

angularjs如何使用多个其他过滤器过滤整数的真值?,angularjs,angularjs-ng-repeat,angular-filters,Angularjs,Angularjs Ng Repeat,Angular Filters,我希望这个问题的标题不会让任何人感到困惑,但我需要找出一些看似非常基本但似乎无法理解的东西 基本上我有多个过滤器,其中两个过滤数字。但是,如果在JSFIDLE上的示例中,一个数字是1 California,另一个数字是13 Arizona,那么如果我选择1,则过滤将同时包括这两个数字 这是我的HTML: <div ng-app='app' ng-controller='myController'> <h3>Records: {{(projects|filter:filte

我希望这个问题的标题不会让任何人感到困惑,但我需要找出一些看似非常基本但似乎无法理解的东西

基本上我有多个过滤器,其中两个过滤数字。但是,如果在JSFIDLE上的示例中,一个数字是1 California,另一个数字是13 Arizona,那么如果我选择1,则过滤将同时包括这两个数字

这是我的HTML:

<div ng-app='app' ng-controller='myController'>
<h3>Records: {{(projects|filter:filter).length}} of {{projects.length}}</h3>
<p><input type="text" name="generalSearch" placeholder="Search Project Title" ng-model="filter.name"></p>
<p><select ng-model="filter.stateID" 
      ng-options="item.stateID as item.state for item in st_option">        </select>
    <select ng-model="filter.countyID" 
      ng-options="item.countyID as item.county for item in co_option | filter:{ co_state_id : filter.stateID }">
  </select></p>

  <p><a href="" id="clear-filter" ng-click="clearFilter()">Reset Filters</a></p>

  <div ng-repeat="project in projects | filter:filter">
    <div>
  <br>Name: {{ project.name }}
  <br>State: {{project.state}}
  <br>County: {{project.county}}
  <br>
  <span ng-hide="{{project.stateID}} "></span>
  <span ng-hide="{{project.countyID}} "></span>
</div>
我在这里创建了一个JSFIDLE:

我知道我需要将true添加到过滤器中,但我不确定在何处或如何添加。

过滤器有第三个参数,即比较器函数。作为语法糖,第三个参数也可以将值true表示严格比较。这意味着您只需将:true添加到县过滤器的末尾:

<select ng-model="filter.countyID" 
      ng-options="item.countyID as item.county for item in co_option | filter:{ co_state_id : filter.stateID }:true">
</select>

。现在,当您选择加利福尼亚州时,您只会看到加利福尼亚州的县。

Hi@david grinberg,我正在尝试按stateID筛选列表。通过测试,我可以选择加利福尼亚州、亚利桑那州和犹他州,结果仍然显示,这是我试图解决的问题。当我选择它时,我只想显示California。
<select ng-model="filter.countyID" 
      ng-options="item.countyID as item.county for item in co_option | filter:{ co_state_id : filter.stateID }:true">
</select>