-
Notifications
You must be signed in to change notification settings - Fork 27.4k
transcludeControllers of $compile return function not work #13793
Comments
Hi,
I can't tell you why there's another level of indirection - maybe it's left over from some earlier code. |
Thanks Narretz! |
A little more clear, perhaps is better write in the documents that the controller of parent is reachable only from the child directive: Look here: https://jsfiddle.net/qq4gqn6t/8/ in particular at row 30 "require: ['?^csDad', 'csSon']", I put "?^cdDad" (?^ - Attempt to locate the required controller by searching the element and its parents or pass null to the link fn if not found.) I think that the issue is that the controller, trought the "transludeControllers", is put to the child directive and not to parent (from where it come) I hope I have been clear Thanks again Narretz |
I thought it was clear that the transcludeControllers would be applied to the compileNode (i.e. the top level node in your compile fn). That basically means the controller instances are put as data into the compileNode. So any directives on the compileNode and its children that require controllers can access the data. |
You are right! |
Perhaps I don't understand the document at the end of https://docs.angularjs.org/api/ng/service/$compile, but when I try to pass the controller to directive seem not work.
Es: https://jsfiddle.net/qq4gqn6t/5/ don't work (the parent controller not pass to child directive)
Es: https://jsfiddle.net/qq4gqn6t/6/ work but not use the "transcludeControllers" options, like is write in document.
The text was updated successfully, but these errors were encountered: