我试图在文本框中键入文本,我需要选择此值进行过滤。如何在angularJs
中选择文本框值 <!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.0-rc.0/angular.min.js"></script>
</head>
<body ng-app="">
<div ng-init="specialists = [{name:'aaaa', id:'555-1276'},
{name:'bbbb', id:'800-322-435'},
{name:'cccc', id:'555-4321'},
{name:'dddd', id:'555-5678'},
{name:'eeee', id:'555-8765'},
{name:'ffff', id:'555-3212'}
]"></div>
<label>Search: <input ng-model="user.specialistSearch"></label>
<table>
<tr><th>Name</th></tr>
<tr ng-repeat="specialist in specialists | filter:user.specialistSearch">
<td>{{specialist.name}}</td>
</tr>
</table>
<hr>
</body>
</html>
这里当我试图键入我需要的文本时,选择值。如何选择角度js中的文本框值
答案 0 :(得分:0)
你必须试试这个......
<div ng-init="specialists = [{name:'aaaa', id:'555-1276'},
{name:'bbbb', id:'800-322-435'},
{name:'cccc', id:'555-4321'},
{name:'dddd', id:'555-5678'},
{name:'eeee', id:'555-8765'},
{name:'ffff', id:'555-3212'}
]"></div>
<p><input type="text" ng-model="test"></p>
<table>
<tr><th>Name</th></tr>
<tr ng-repeat="specialist in specialists | filter:test">
<td>{{specialist.name}}</td>
</tr>
</table>