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

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -