Hello,
I have a strange issue with ViewChild behaviour.
As you can see, i have a “basic” html
<ion-slides pager="true" #slides>
<ion-slide>
<ion-button expand="block" (click)="nextStep()">Next</ion-button>
</ion-slide>
In ts file, im trying to access like that
@ViewChild('slides') slides: IonSlides;
nextStep() {
console.log('ionSLide', this.slides);
}
And when i check the value in log, i always have “ElementRef” and not the componentInstance.
(I tried with static true/false, no differences) and with the read: IonSlides my variable is undefined.
I use ViewChild with angular since 3 years and i never had an issue like that, what is wrong ?
I’m using Ionic 5 and angular 10 or 11 (same issue).
Thanks guys !