Access component from Router


#1

Sometimes it is necessary to access a component from the router or controller, e.g. to reload it or to open/close something etc. What is currently the preferred way to access a component from a router?

There is a discussion on stackoverflow, but this seems outdated:


#2

The whole idea with components are that they should be isolated and unaware about the world around them. However, this can lead to issues when you need to communicate with components and when you have parent/child components that need to know about each other.

Handling actions from the component is quite easy (this.sendAction() and action='handleIt') but sending actions to components can be a bit tricky. Most of the time I try to write my code so that I can pass properties to my components like isOpen and pass data as properties (a reload within the component could observe it’s properties and act accordingly).