In my app, there is a search box and a list of results. The search box is controlled by SearchCtrl
, while the list of results is managed by DocListCtrl
. When a user submits a query, SearchCtrl
emits an event that DocListCtrl
listens for in order to update the results. Everything works well when a user manually enters a query, but I run into issues when a user copy/pastes a URL like "/app/search?q=foo." In this scenario, the search event gets broadcast before DocListCtrl
is ready, leading to outdated results.
Is there a way for one controller to establish a dependency on another? Should I consider having SearchCtrl
store the data somewhere so that DocListCtrl
can access it once it's fully loaded?