Angularjs Angular JS,带有选择框的筛选表
我有一张桌子。我想根据在选择框中选择的值筛选表。比较值在选择框中为{pipe.pipe_id}},在表中为{dimension.pipe_id}。我想有一个简单的解决办法?有什么建议吗Angularjs Angular JS,带有选择框的筛选表,angularjs,angularjs-ng-repeat,angularjs-filter,Angularjs,Angularjs Ng Repeat,Angularjs Filter,我有一张桌子。我想根据在选择框中选择的值筛选表。比较值在选择框中为{pipe.pipe_id}},在表中为{dimension.pipe_id}。我想有一个简单的解决办法?有什么建议吗 Pipe: <select id="select01"> <option ng-repeat="pipe in pipes">{{pipe.code}} - {{pipe.title_en}}</option> </select>
Pipe:
<select id="select01">
<option ng-repeat="pipe in pipes">{{pipe.code}} - {{pipe.title_en}}</option>
</select>
<table class="table table-striped">
<thead>
<tr>
<th>Pipe</th>
<th>Size</th>
<th>Inner diameter</th>
<th>Outer diameter</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="dimension in dimensions" >
<td>{{dimension.pipe_id}}</td>
<td>{{dimension.nominalsize}}</td>
<td>{{dimension.innerdiameter}}</td>
<td>{{dimension.outerdiameter}}</td>
</tr>
</tbody>
</table>
管道:
{{pipe.code}}-{pipe.title_en}
管
大小
内径
外径
{{dimension.pipe_id}
{{dimension.nominalsize}}
{{dimension.innerdiameter}}
{{dimension.outerdiameter}}
我想您正在查找和过滤器:我建议使用
此链接是一个使用待办事项列表的简单示例。
您将需要绑定正在使用的任何输入ng model=“varname”
ng过滤器默认为数组中的所有字段。可以将其过滤到单个列或指向控制器中的函数
搜索字段
<select ng-model="searchparam">
<option value="1">One</option>
<option value="2">Two</option>
</select>
一个
两个
搜索单个列
<select ng-model="searchparam.columnOne">
<option value="1">One</option>
<option value="2">Two</option>
</select>
一个
两个
重复部分
(即使输入指定了特定列,过滤器模型也保持不变)
{{dimension.columnOne}
{{dimension.columnTwo}
使用选择框时,最好使用ng选项。
<tr ng-repeat="dimension in dimensions | filter: searchparam">
<td>{{dimension.columnOne}}</td>
<td>{{dimension.columnTwo}}</td>
</tr>