Due to the way Ionic cache pages a component within a page might be shown/hidden without firing the Angular lifecycle hooks (ngOnInit etc.).
Ionic solves this for pages by using its own set of lifecycle hooks like ionViewDidEnter, but they are only available for the pages themselves.
There are however plenty of cases where a component needs to know if it’s being loaded again - for example, a map component would usually turn the GPS on/off when it’s loaded/destroyed.
Or a form might need to focus on a specific input when it’s loaded.
At the moment the only solution I’ve seen is based on @ViewChild but that requires you tightly couple the parent/child components (page/child component) which goes against a lot of best practices (and means that a new developer implementing the component will run into bugs as he wouldn’t know that they need to do some extra steps).
Are there any other options I’m missing? this is leading to a lot of weird behavior/solutions in our apps
Thanks