Let's say I've declared three class-restricted directives "am-wat", "am-foo", and "am-bar", that each augment the attached element with some behavior, e.g.:
<div am-wat="some data" am-foo="other data" am-bar="lol">
Yadda yadda yadda
</div>
Is there a way to write a directive that mixes in the behavior of the three directives, e.g.:
<div am-trifecta="trifecta args">
Yadda yadda yadda
</div>
such that the trifecta directive invokes the behavior of each of the three directives on that div, passing each directive some args that the trifecta directive came up with? Can it be done in without requiring an intermediate DOM element being added, which might complicated or screw up existing styles?
You could do this a few ways...
1. Use composition:
Here you could just take the linking functions from the other directives and call them. This is a little "brute force" I suppose, but it's legal and straight forward.
2. Recompile the node:
Here you're going to just add the other attributes to the already existing node and tell it to rebind with $compile. Realistically, this is just doing the same thing I showed above. Just in a weird, roundabout way.
There are other ways to do this, but those are the two I could think of quickly off of the top of my head.