jungNitesh
jungNitesh

Reputation: 39

How to reload a component on a change event in angular

I have angular component, which is loading other components , now in a event change say dropdown item selection, i need to reload just one specific component. Is it Possible to do that?

I looked into some answers in stack overflow itself but mostly are about reloading the whole page.

  <dropdown (change)="detectChange($value)" />
  <Component-one></Component-one>

In one component i have a 'drop down' with few values, and other component say 'component-one' already loaded with it , when the value in the "dropdown" changes i need to reload "component-one".

Upvotes: 0

Views: 2340

Answers (1)

Hayk Aghabekyan
Hayk Aghabekyan

Reputation: 1087

It is a general question. First of all you need to understand what you want to achieve in the end.

One way for "reloading" component, pass some data to the component based on the dropdown value, so, it will automatically "reload".

The other way is that you can have url param or query param based on the dropdown value, and on dropdown value change, navigate to the route with new param value, so the component will "reload".

Upvotes: 1

Related Questions