Howto use ion slider in Ionic 6 - angular

First, update to the latest version of Ionic:

npm install @ionic/angular@latest

Once that is done, install the Swiper dependency in your project:

npm install swiper@latest


Add code homeslider.page.html

<ion-content fullscreen class="ion-padding" scroll-y="false"> <swiper-container> <swiper-slide *ngFor="let s of slides"> <img src="{{s.image}}" /> <div class="slide" > <h2>{{s.title}}</h2> <p> {{s.para}} </p> <ion-button color="tertiary" (click)="goToHome()" shape="round"> {{s.btnText}} </ion-button> </div> </swiper-slide> </swiper-container> <!-- slides.component.html --> </ion-content>

Add homeslider.ts


import { register } from 'swiper/element/bundle'; register();











No comments:

Post a Comment

starter ASP.NET Core Web API project with example

Starter ASP.NET Core Web API project that follows all the best practices listed above. 🛠️ Starter Project Overview We’ll build a Produc...

Best for you