Reputation: 1845
I'm using AngularJS and I've got a doubt.
I have something like this:
<a href="#">
<p>Hello World!</p>
</a>
I want to remove the anchor, but not its content. If I use ng-show/ng-hide, according to the condition it removes everything, the anchor and even the paragraph.
How can i remove just the anchor keeping the content displayed (but unlinked)?
Thanks!
Upvotes: 0
Views: 961
Reputation: 133403
Might not be best approach.
You can use
<a ng-if="condition == false">
<p>Hello World!</p>
</a>
<p ng-if="condition == true">Hello World!</p>
In place of ngIf
you can use ngShow
or ngHide
Upvotes: 1
Reputation: 5542
use ng-href and an expression:
<a ng-href="{{show()? '#' : ''}}">
<p>Hello World!</p>
</a>
Upvotes: 2