Angular filter list without ng-repeat

前端 未结 4 2056
夕颜
夕颜 2020-12-25 08:56

Is there any good way of using angular to filter a list WITHOUT ng-repeat? I dont want to use javascript to draw the list at first, but i want to use angular to filter it af

4条回答
  •  忘掉有多难
    2020-12-25 09:14

    you can make it as Michel Tome wrote just more generic way.

    
    
    
    • Banana
    • Apple
    • Orange

    And in the JS take the text from the event.

    $scope.isSimilar = function ($event) {
       var text = $event.target.textContent;
       var pattern = new Regexp(text, "gi")
       return pattern.test($scope.search);
    }
    

提交回复
热议问题