How to use Regex with ng-repeat in AngularJs?

前端 未结 5 1301
栀梦
栀梦 2020-12-14 08:58

I want to use regex in ng-repeat. I have tried the following code but its not working.

<
5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-14 09:33

    Regular expressions are indeed powerful and can handle all kinds of matches including an exact match like ^c5$.

    However, the body of this question reveals that the issue would be addressed by always filtering by exact matches.

    You can specify that the Angular filter should use the exact match comparator by setting the 3rd argument to true:

    filter:{type:'c5'}:true
    

提交回复
热议问题