{{ x.a }} {{ x.a }} {{ x.a }}

Apply ng-switch only on tags

47 Views Asked by At

I have the following code that works:

<ng-switch on="$last">
    <span ng-switch-when="true">
        {{ x.a }}
    </span>
    <span ng-switch-default>
        <a href="{{x.b}}">
            {{ x.a }}
        </a>
    </span>
</ng-switch>

I'd like to avoid duplicating the {{ x.a }} line.

Is this possible?

So, I'd like to apply the ng-switch only on the a tag, not also on its content.

1

There are 1 best solutions below

0
Rahul K Pandey On

you can probably set x.b = javascript:void(0) based on your conditions in your js file. Along with it ng-class expression which will set text-decoration to none