Hello Angular community!

I've stumbled upon a problem I couldn't find a way to solve on my own.

What I want is to wrap some content in another element on condition. For 
example, I want to wrap my content in

<a ng-href="{{ link.url }}">{{ content }}</a>

if *link* is present on scope, e.g.:

<a ng-href="{{ link.url }}" wrap-if="{{ !!link }}">{{ content }}</a>


We can't use directive's *compile()*, because condition is changing 
dynamically and I'm not sure how to manipulate the DOM correctly from 
linking function and even if it possible from technical standpoint.

The idea is to make code DRY and to avoid multiple references to *{{ 
content }} *(it is a very complex set of nested elements and directives in 
my case).

I will gladly accept any thoughts on this.

I've created a simple fiddle for this issue: 
http://jsfiddle.net/slavafomin/d4ujz1j1/

Thank you!


-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to