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!
use ng-href and an expression:
<a ng-href="{{show()? '#' : ''}}">
<p>Hello World!</p>
</a>
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.