There are hundreds of articles and code snippets on the internet. But I'm sorry that I'm not able to implement any one of them correctly. I've followed these study materials:
- Filtering in AngularJS
- Filtering in Angular
- Angular filters: w3schools
- JavaScript Array filter() Method
I also came across: ng-repeat="data in myController.data | filter:{filterFlag:'true'}"
. But I don't understand this approach.
Instead of pasting the code here I thought creating a stackblitz will be more helpful.
I also tried understanding the concept from this code. But this was ReactJs code so I got myself more confused.
I'm not getting any error or warning. My code returns the entire array (from which I'm trying to filter) or nothing at all. I'm not able to the understand the concept very well.
Dear community, don't write the code for me. but please point out my mistakes or suggest so that I can correct them.
The filter should work for both username
or location
(so that I can show all users who belong to same location).