Ng-repeat attribute filtering

Ionic faithfuls,

I have a list as shown in the codepen example, which I am trying to filter using the search input box. At present adding the specific attribute filter (filter:{name:personSearch.name}) is causing no items to show up at all whereas leaving it open (filter:personSearch.name) works fine.

For the app I am trying to build, I will like the filter to be specific as I have more filters I will like to add for a more effective search.

Can anyone please guide me as to where I am going wrong with this?

Thanks in advance

I’m not an expert in filters, but in another web application I used angular in it seemed that it’s the property name that it will use. There may be a way to custom define it but I haven’t run into it. So for this particular app I had a text box with the model=“query.code” and then just like yours, i’d have my filter filter:query.code. Now if I wanted to filter by name I had to change the model to query.name and the filter query.name.

I know it isn’t much, but I hope it gets you going in the right direction.

define

$scope.personSearch = {name: ''};

before

$scope.people = new Array(); 
2 Likes

Thanks @soutlink, that solved it for me.

1 Like