Yes - outside event
No - Not exactly replace with original content
I need to be able to individual toggle each "inner" directive. Basicaly I have sets of directives with a on/off for each one.
So lets say I have 3 directives in the set
Directive A2B that replaces elements <a... with <b...
Directive B2C that replaces elements <b... with <c...
Directive A2D that replaces elements <a... with <d...
and I have the directive priorities, such that:
static page
<div data-root-directive>
<a...
</div>
root directive wraps it only in the enabled directives and compiles with transcludes and stuff
<div data-root-directive>
<div data-a2b>
<div data-b2c>
<div data-a2d>
<a...
</div>
</div>
</div>
</div>
after compiling we are left with the DOM (note A2D never executes because of the directive priority)
<div data-root-directive>
<div data-a2b>
<div data-b2c>
<div data-b2c>
<c...
</div>
</div>
</div>
</div>
Now, dynamically I want to say, ok, I want to disable A2B and enable A2D
So there's 2 problems at this point.
The first is that the dom is now changed to <c... but it should all be recompiled based on the original <a...
The second is the mechanics of how to actualy do the enable/disable
I am trying to avoid a lot of manual jquery, and stick with angular only if I can, but ill do whatever works....
Sorry for the huge response, I hope its not confusing.