I have a simple app with a search box and a list of results. The search box has its own controller SearchCtrl
, and the list of results has another, DocListCtrl
. The SearchCtrl
emits an event when the user submits and the DocListCtrl
listens, and updates the results. It works fine if a user enters a query and submits- However, my problem is when a user copy/pastes a URL such as "/app/search?q=foo" the search event is broadcast before the DocListCtrl
is ready, and therefore the results are not updated.
So in general, is there a way for one controller to declare a dependency on another? Should I have the SearchCtrl
persist the data somewhere which the DocListCtrl
can look on when it finally loads?