I have a home component, with slider-item component which has my ion-slides. In home I have an ion-header which contains Previous and Next Buttons.
home.page.ts:
import { Component, ViewChild } from '@angular/core';
import { DataService, Item } from '../services/data.service';
import { SliderItemComponent } from '../slider-item/slider-item.component';
...
export class HomePage {
@ViewChild(SliderItemComponent) slides;
ngAfterViewInit(){
this.slides.onlyExternal = true;
}
...
nextSlide(){
console.log(this.slides);
this.slides.slideNext();
}
slider-item html:
<ion-slides modes="md" #slides>
home.page.html:
<ion-button (click)="nextSlide(slides)">Pick</ion-button>
When I click on the button I get:
SliderItemComponent {data: DataService, __ngContext__: LComponentView_HomePage(294)} //console.log here
core.js:6479 ERROR TypeError: this.slides.slideNext is not a function
So I see that this.slider is capturing the element/component correctly... What am I missing?