AngularJS filter for multiple strings

后端 未结 6 923
时光取名叫无心
时光取名叫无心 2020-12-14 23:32

I\'m working through the AngularJS tutorial, and understand the basics of

However, the out of the box implementation seems limited to just filter the list of items

6条回答
  •  萌比男神i
    2020-12-15 00:18

    Alternatively you could use the default Angular filter within your custom filter like so:

    angular.module('app').filter("multiWordFilter", function($filter){
        return function(inputArray, searchText){
            var wordArray = searchText ? searchText.toLowerCase().split(/\s+/) : [];
            var wordCount = wordArray.length;
            for(var i=0;i

    This could be embellished further with user2005009's AND_OR comparator.

提交回复
热议问题