Reputation: 21830
http://plnkr.co/edit/QMrrDycuMyEG7cJkCB5f?p=preview
In the page's MainCtrl
scope, we have a variable defined: $scope.listen
Under that, i've got a directive called titleSetter
which has an attribute title
which is listening to the listen
variable. It updates correctly.
Under that, I've got another directive called listeningComponent
, whose job is also to listen to that listen
variable, and it has a scope variable listenertext
which, like the titleSetter
directive, has listen
passed into it.
Under that, I've got a stage, which is designed to compile directives into a little stage area. Inside it, there is a #stage
div, which is where the compiles go. This directive has a link function that compiles the listeningComponent
into it.
Go ahead and type something in the box above which is bound to the main page's listen
variable. Everything will update with it... almost. As you can see in the Plunker, the listeningComponent
, when compiled into stage
, cannot listen to the listen
variable.
How do I get it to listen to that variable?
Upvotes: 0
Views: 45
Reputation: 9476
Seems you forgot to define listen in stage scope, i.e. just
listen : '='
in js, and listen="listen"
in html.
http://plnkr.co/edit/2BmXDHjINNxaOXy6R7Yb?p=preview
Upvotes: 1