-
Notifications
You must be signed in to change notification settings - Fork 27.5k
require: '^something' starts searching on the current node, not the parent. #8511
Comments
This is a well known issue, and there have been pull requests for fixing this. My view: we shouldn't change the behaviour of |
Yeah, changing the behaviour of If you search for a parent, you should have used I suspect that if you take the I'd go with fixing |
I stand corrected - it does makes sense to introduce a Consider a tooltip directive that can have a config attribute:
It can be useful if the
So having |
PR for documentation fix: #8622 |
+1 for |
Yeah you know what? lets get this resolved: @IgorMinar / @jeffbcross / @btford what do you think about landing the fix for rc1 or rc2? It's been waiting for a while (#4540) |
I'm +1 on this |
Me, too. We need @IgorMinar's blessing of the API addition (or @tbosch in his absence). |
Implement option to strengthen require '^' operator, by adding another '^'. When a second '^' is used, the controller will only search parent nodes for the matching controller, and will throw or return null if not found, depending on whether or not the requirement is optional. Closes #4518 Closes #4540 Closes #8240 Closes #8511
The docs
The docs say:
Code example
Now consider this DOM (plunk):
With this directive:
If the docs are correct, this code should throw an error, as the top level node doesn't have a parent node. But instead the console output is:
The Angular code
This is the Angular code (jqLite):
And you can see that the InheritedData search starts on the current element, not on the parent.
Hopefully a bug
So either the docs are wrong, or the code is wrong.
I'm not sure why the search starts on the current element, or what will be the consequences of changing it to start on the parent. But I've already been involved with 3 directives that could benefit from '^' search starting on the parent, as often you wish to have an hierarchy of the same directive.
The text was updated successfully, but these errors were encountered: