Answer the question
In order to leave comments, you need to log in
How to get a filtered array?
<input ng-model="this.searchText" type="text">
<div ng-repeat="obj in this.objects | filter: this.searchText">
<p> {{obj.name}} </p>
</div>
<div ng-if="this.objectIsEmpty()">
Objects is Empty :(
</div>
this.searchText = '';
this.objects = [{id: 1, name: 'test1'}, {id: 2, name: 'test2'}, {id: 3, name: 'test3'}]
function objectIsEmpty() {
return !this.objects.length;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question