Hello,
I’m having an issue with the slides.
<!-- HTML -->
<ion-slide *ngFor="let branch of branches">
{{ branch.blabla }}
</ion-slides>
// Typescript
ngAfterViewInit() {
// Doingh things and adding to branches from an @Input()
this.branches.push({ ... });
this.logger.debug(this.branches);
}
Details:
This is an extract from a component. The log you can see at the end shows an array with a length of 5 and no actual issue.
Why my slides is only of a length of 1 ?
Thanks.
I’m not sure that this is related, but you can only access @Input
properties from inside ngOnChanges()
. I don’t believe they’re reliable in ngAfterViewInit()
. I can tell you that adding slides from asynchronous subscriptions does work.
I checked with a log.debug the object I built in ngAfterViewInit()
Nothing seems out of place, yet, the slides won’t update.
This is not the first time I have problems with Slides, maybe it’s badly designed.
I don’t think the problem originates from the slides component but rather than the array. Are you sure the push is successfully done ?
Perhaps you should use ngOnInit instead.
Yes, as I previously mentionned, I logged this.branches
and everything checks out.
That was it. Thank you !