Ion-segment change causes component to refire ngOnInit

Is it normal for a component to fire its ngOnInit event when the hosting page changes between segments/templates?

While you wait for better answers, I’d like to try convincing you that you shouldn’t care, and need to write your app so that it behaves properly regardless. The only thing I rely on with lifecycle events is that they are called pairwise: there won’t be two ngOnInits without an intervening ngOnDestroy. That way, if external forces (including the whim of framework developers) cause components to be cached more or less aggressively, my app code is unaffected.

The idea was to have a component that contains ion-slides which loads its own data for slides when the page containing it loads - based of an input property based to the component.

eg. <app-slides [query]=“query”>

this works fine until I put the component in the content area of a segment and change between the segments.

can you suggest a better way to accomplish this? should components not load their own data, instead passing the data to the component from the page?

I tried without using a component but besides duplicating code, causes a noticeable lag when changing segments

This is the crucial part of your comment - I would do the work in ngOnChanges given what you’ve said here.