0

There is the following question: I have an outer controller (HomeController) and an internal controller (PostsController). Can I get access and change variable in HomeController from PostsControlle r? I know that I can read HomeController's variable from PostsController, but what's about writing? Thanks in advance.

malcoauri
  • 11,904
  • 28
  • 82
  • 137

1 Answers1

1
  1. Parent scope variables are available via $parent so you can change those in the child directive.
  2. You can use $emit to propagate the value you want to change to the parent controller. You need to use $on to subscribe to the event.
Kiran P
  • 299
  • 2
  • 11