Hi I have an isolated directive. I want to detect if the scope has been clicked on using $scope.$parent object. Is this possible. I am trying to listen to a click event on a parent scope using the scope object variable...is this possible?
-
is it possible to make a plunkerShayuh– Shayuh2017-06-23 06:36:20 +00:00Commented Jun 23, 2017 at 6:36
-
Why don't just pass that object from parent scope to the isolated scope?neptune– neptune2017-06-23 06:45:42 +00:00Commented Jun 23, 2017 at 6:45
-
@neptune how do i do that?Baama– Baama2017-06-23 06:47:43 +00:00Commented Jun 23, 2017 at 6:47
-
@flexxxit see here: weblogs.asp.net/dwahlin/…neptune– neptune2017-06-23 06:49:05 +00:00Commented Jun 23, 2017 at 6:49
Add a comment
|
1 Answer
In this particular instance, you would want to use $scope.$on to listen to the event occurring.
Todd Motto provides a great example to understand this in more detail.
https://toddmotto.com/all-about-angulars-emit-broadcast-on-publish-subscribing/