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

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -