bug: ionic 4 ion-slide set initialSlide not work immediately
See original GitHub issueBug Report
Ionic version:
[x] 4.10.0
Current behavior: When I want to set initialSlide, but it’s still shows default value first, then change to value that I set
Expected behavior: It should not show first image
Steps to reproduce: Start project and then refresh home page
Related code: Home.page.ts file
slider = [
'assets/images/download copy.jpg',
'assets/images/download-2 copy.jpg',
'assets/images/download-1 copy.jpg',
'assets/images/download copy.png',
'assets/images/download-1.jpg',
'assets/images/download-3 copy.jpg',
'assets/images/download-2.jpg',
'assets/images/download-4.jpg',
'assets/images/download-3.jpg',
'assets/images/download-5 copy.jpg',
'assets/images/download-6 copy.jpg',
'assets/images/download-8 copy.jpg',
'assets/images/download-4 copy.jpg',
'assets/images/download-7 copy.jpg',
]
slideOpts = {
initialSlide: 10,
speed: 400
}
home.page.html file
<ion-header>
<ion-toolbar>
<ion-buttons slot="start">
<ion-menu-button></ion-menu-button>
</ion-buttons>
<ion-title>
Home
</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-slides pager="true" [options]="slideOpts" style="height: 95%">
<ion-slide *ngFor="let img of slider;let i = index">
{{i}}
<img [src]="img" (error)="$event.target.src = 'assets/images/download.png'" />
</ion-slide>
</ion-slides>
</ion-content>
Github repo: - https://github.com/tajinder-logiciel/slider-issue
Ionic info:
Ionic:
Ionic CLI : 5.2.7 (/Users/tajinder/.nvm/versions/node/v12.8.0/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.10.0
@angular-devkit/build-angular : 0.801.3
@angular-devkit/schematics : 8.1.3
@angular/cli : 8.1.3
@ionic/angular-toolkit : 2.0.0
Cordova:
Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 8.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.1, (and 4 other plugins)
Utility:
cordova-res : not installed
native-run : 0.2.8
System:
Android SDK Tools : 26.1.1 (/Users/tajinder/Library/Android/sdk)
NodeJS : v12.8.0 (/Users/tajinder/.nvm/versions/node/v12.8.0/bin/node)
npm : 6.10.2
OS : macOS Mojave
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:13 (1 by maintainers)
Top Results From Across the Web
Ion-slides starts at index 0 then swaps to initialSlide slide
The issue is that it doesn't load the slider properly; it starts with the slide at index 0 and afterwards abruptly switches to...
Read more >ion slider not working in ModalController ionic 4 - Stack Overflow
Try to add a .then function at the end like that: this.ionSlides.update().then(() => console.log('updated')) }. If not working try the ...
Read more >Building a slideshow with Ionic Slides API - Mastering Ionic
In this coding tutorial we will walk through using the Ionic Slides API to create stunning slideshow components for our mobile applications ...
Read more >IonSlidesのinitialSlideオプション使用時に先頭スライド ... - Qiita
Swiper.jsオプション一覧. issuesに似たような現象があがっています。 bug: ionic 4 ion-slide set initialSlide not work immediately ...
Read more >Use Swiper JS with ionic 6 (ion-slides alternative)
Now in your html file add following swiper code for slides. Here we are using. [initialSlide]=1 This will set slider to show starting...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have the same issue. Very annoying 😦
Any update on this issue