Can I use filters inside ngIf statement

后端 未结 1 1204
萌比男神i
萌比男神i 2021-01-14 01:14

Is there a way to use filter inside a ng-if statement ?

for example:

   
&
相关标签:
1条回答
  • 2021-01-14 01:59

    Yes that works. Here's a plunkr: http://plnkr.co/edit/vpCzutMnEFlTWC9gceU3?p=preview

    angular.module('plunker').filter('two', function() {
      return function (input) { return 2; }
    });
    

    Equivalent of your code:

    <div ng-if="2 == ('foobar' | two )">
      <span>Hello</span>
    </div>
    

    So your problem must be elsewhere.

    0 讨论(0)
提交回复
热议问题