javascript - How do i get a compiled directive to listen to the variables outside of its scope? -
http://plnkr.co/edit/qmrrdycumyeg7cjkcb5f?p=preview
in page's mainctrl scope, have variable defined: $scope.listen
under that, i've got directive called titlesetter has attribute title listening listen variable. updates correctly.
under that, i've got directive called listeningcomponent, job listen listen variable, , has scope variable listenertext which, titlesetter directive, has listen passed it.
under that, i've got stage, designed compile directives little stage area. inside it, there #stage div, compiles go. directive has link function compiles listeningcomponent it.
go ahead , type in box above bound main page's listen variable. update it... almost. can see in plunker, listeningcomponent, when compiled stage, cannot listen listen variable.
how listen variable?
seems forgot define listen in stage scope, i.e. listen : '=' in js, , listen="listen" in html.
Comments
Post a Comment