0

Hello everyone I have a component with ag grid that is a field after loading some accounts and a sidebar I want when I navigate into another component by url and come back to the other component it doesn't reload.

I tried using local storage, but every time it passes by ngOnInit I want from the component to be loaded just the first time after the redirection and stays frozen and hold his current state.

  • 1
    When navigating to the same component, by default the `ngOnInit` will not run every time. I would suggest you to inject the `ActivatedRoute` to your component and subscribe on the params change. You can a similar thread here: https://stackoverflow.com/a/42835928/6442841 . Also, some code would be useful to help you more. – StPaulis Jun 13 '22 at 12:57
  • but every time i switch between routes it triggered ngOninit and reload all the data and i have to pick a date , filter the accounts and then load them. i don't want to pass the data with the url i want from the component to stay freezed like when i do minimize to the browser – sohaibex Jun 13 '22 at 13:17
  • You don't need to pass any data, please read the relative thread. – StPaulis Jun 14 '22 at 08:42

0 Answers0