I have a directive that includes another one.
The child directive is used widely throughout my application, while the parent one is just used in one place.
I would like to add a binding to the child directive's input
element. However, this binding would be necessary only when the directive is placed within the parent, not if it is used as a standalone.
Now i wonder about the best way to do this.
I thought about cycling the child nodes of my parent directive until i reach the input
, then bind to it. However, this will lead to a confusing, neboulous process like this one:
$element.find('suggestion').childNodes[0].childNodes[1] // ... and so on
If i try to find the input directly, i get an empty object.
Is this the way to go or am I unaware of a better method?