Answer the question
In order to leave comments, you need to log in
Is it possible to get the value of a variable from a directive in a controller?
Good afternoon!
The scope.directiveVar variable is declared in the directive. In the controller, I need to get the value of this variable. A directive from a third-party module that is injected as a dependency to the main application module. Is it possible to do so?
Answer the question
In order to leave comments, you need to log in
It is best to use the pub/sub pattern in this case.
Angular uses $broadcast , $emit , $on functions for this .
Here's a good article about the difference between broadcast and emit and how it works in general: toddmotto.com/all-about-angulars-emit-broadcast-on...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question