AngularJs : how to use multiple condition inside ng-switch?

3.3k views Asked by At

I have a div based on switch but in one particular case even when switch case will be true I need to display another link based on different condition. Can some one suggest me any ideas ?

  <div ng-switch="hasUrl">
    <a ng-switch-when="true && row.id.indexOf(:) < 0" href="{{url + row.id}}">
    {{getName(row)}}
    </a>
    <a ng-switch-default href=".......">
      {{getName(row)}}
    </a>
  </div>
2

There are 2 answers

0
Sajeetharan On BEST ANSWER

ngswitch only allows you to compare a single condition.

if you want to test multiple conditions you can use ng-if

If you still need to use multiple conditions, look at the answer with a directive.

AngularJS: ng-switch-when with an OR

1
Chiu On

You may need other tags such as ng-show and ng-if