If you have two area's on a page, i.e
<div ng-controller="LeftController">
</div>
<div ng-controller="RightController">
</div>
And lets say the LeftController
can live and exist without the RightController
. But should the RightController
exist and something change ... then the LeftController
needs to know about that change.
How can the LeftController
know subscribe to those changes? Does that require a framework like Amplify or is this something that can be handled in Angular?
Usecase
So the problem I'm solving is theres some tabs on the screen. The user may or may not have access to either tabs.
When the tab is loaded initially, it loads from the server.
Tab 2 (RightController) may load before Tab 1 (LeftController), if Tab 1 doesn't exist or isn't loaded yet, and Tab 2 publishes a change. Nothing happens. If Tab 1 is loaded, user goes to Tab 2, changes a value, that may affect the UI in Tab 1. So Tab 2 publishes that hes changed. Tab 1 now changes what he needs based on the new information.