Reputation: 165
So, I'm trying to Import Ionic Slides to my project, but I'm getting this message: "... has no exported member 'Slides'"
I'm importing like this:
import { Slides } from '@ionic/angular';
then the rest of the code:
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
@ViewChild("audio") audio;
@ViewChild(Slides) slides: Slides;
constructor(public navCtrl: NavController) {
}
ngAfterViewInit() {
let self = this;
this.audio.nativeElement.oncanplaythrough = () => {
this.audio.nativeElement.onplay = function () {
self.slides.autoplay = 1000;
self.slides.startAutoplay();
};
this.audio.nativeElement.onpause = function () {
self.slides.autoplay = undefined;
self.slides.stopAutoplay();
};
};
}
}
Upvotes: 4
Views: 4871
Reputation: 528
this one solved my problem in ionic 4
import { IonSlides } from '@ionic/angular';
export class IntroScreenPage implements OnInit {
@ViewChild('slides', { read: true, static: false }) ionSlides: IonSlides;
i passed second parameter { read: true, static: false }
Upvotes: 1
Reputation: 1366
import {IonSlides} from '@ionic/angular';
export class HomePage {
@ViewChild(IonSlides) slides: IonSlides;
Upvotes: 2
Reputation:
This answer on a GitHub issue says there is a rename in the documentation for Ionic 4. Renaming Slides
to IonSlides
should do the trick.
Please take a look at the breaking changes for beta.18: https://github.com/ionic-team/ionic/blob/master/CHANGELOG.md#angular-prefixed-ion--components
Everything is prefixed with Ion, so instead of Slides it's IonSlides:
import {IonSlides} from '@ionic/angular';
...
@ViewChild(IonSlides) slides: IonSlides;
Upvotes: 12