javascript - ng-repeat empty on load when applying ng-model filter -
i have code :
<input type="text" placeholder="search..." ng-model="query" /> <table ng-controller="employees" ng-init="init()"> <tr ng-repeat="employee in employees | filter:{ name: query }"> <td>{{employee.name}}</td> </tr> </table>
the problem when page loads, there nothing in table, until type in search input. matching appears, , if clear input, employees displayed (as should on load).
i don't have problem if write filter: query
instead of filter:{ name: query }
.
how can have data displayed on load filter:{ name: query }
?
add line employees
controller:
$scope.query = '';
Comments
Post a Comment