In HTML template I have directive ng-repeat:
<div ng-repeat="friend in friendList.active | filter:searchName">
Also input field with ng-model="searchName":
<input type="text" ng-model="searchName" maxlength="10" placeholder="">
When I typing text blocks inside ng-repeat is not sorted, why?
Response friendList.active AJAX is:
{"534":{"name":"Danil","photo":"http://who.com/public/images/non_photo_user.png","id":"534","unread":null,"online":0},"541":{"name":"Aysel Bukarova","photo":"http://who.com/public/images/non_photo_doctor.png","id":"541","unread":null,"online":0}}
Tou need to convert the response object in the array because the filter is working with arrays. Or you can write your own filter that will work with the properties of the object. See the sample from Rise Ledger. Name for input field is not required.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With