1

I have an array of objects, and in the object I have an element {url:"that happens to have the word search in it"} , so when filtering if you type "arch", this link field doesn't allow for filtering as one would expect for the rest of objects.

It's a pretty big object and I would like to search all of it, I just want to exclude the url element. I can't remove it, as it pertains to a link used in the ng-repeat. I also have a location search that I probably need to reevaluate in order to create a filter function that handles both.

Any help would much appreciated thanks.

Heres a Plunker

1

1 Answer 1

1

You can create a searchFilter in your controller. Put this in your html:

<input name="searchText" type="text" class="form-control" placeholder="Search" ng-model="vm.searchText">

Put this in your controller:

vm.searchFilter = function (obj) {
    var re = new RegExp(vm.searchText, 'i');
    return !vm.searchText || re.test(obj.title) || re.test(obj.city);
};

Then this on your ng-repeat:

<tr ng-repeat="items in vm.myitems | filter:vm.searchFilter">
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.