Let's say I have two HTML elements with the same tag, but each with a different set of properties. How can I conditionally choose between them?
I have the following two tags:
<a ui-sref="root.one(::{param: value})">
<a target="_blank" href="{{::model}}">
I need to conditionally choose one of them, and add other markup until the closing tag. Can something like this work?
<a ng-if="::condition" ui-sref="root.one(::{param: value})">
<a ng-else target="_blank" href="{{::model}}">
<div>
more nodes
</div>
</a>
At the end I figured this to be impossible, so I resorted to merging the A tags like this:
<a ng-attr-target="{{::!condition? '_blank' : undefined}}" href="{{::model}}" ng-attr-ui-sref="{{::(condition? 'root.one(::{param: value})' : '.')}}">
Remarks:
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.