well hello
I have a app where i have added a silder with button and on buttton i have wrritten (click) event
But problem is it is not getting triggered
Noticable thing is that click gesture (background changes when we click on button ) is there whenever i click on that button.
I have only one ion-slide in slides
html code
<ion-slides autoplay="3500" loop="true" speed="3000">
<ion-slide *ngIf="img==''">
<div class="box">
<button ion-button icon-only (click)="profile()">
<ion-icon name="camera"></ion-icon>
</button>
<h6 no-padding no-margin >Upload Your Picture</h6>
<p no-padding no-margin class="margin12px">to get more matches</p>
<button ion-buttons></button>
</div>
</ion-slide>
<ion-slide>
<h5>Complete Your Profile</h5>
<button ion-button icon-end outline (click)="profile()">
Profile <ion-icon name="person" ></ion-icon>
</button>
</ion-slide>
</ion-slides>
in ts file calling function
profile(){
console.log('profile');
this.navCtrl.push(HomePage);
}
Can you please post a snippet of your code
you didnt show any code, here is some working example:
<ion-slides *ngIf="gal== 1" pager="true" zoom="true" class="gal" initialSlide={{pic1}}>
<ion-slide *ngFor="let s of images">
<img src="{{s.pic_url}}" (click)="zoom(s.pic_url)">;
</ion-slide>
<ion-slides>
1 Like
Updated my question âŚ
i getting this issue when my first condition is false so all i have only one slide in slides
Does it return any error on console?
May I know the value of img
?
Thanks
i have backend for it from there i am getting value of img which could any img src and its string.
about errror thing as i mentioned the m click on it but nothing happens neither in console.
1 Like
araza
September 18, 2019, 12:49pm
#7
same issue.
first time click event work for me. After that not working. html is below :
<ion-slides pager=âtrueâ autoplay=â3000â loop=âtrueâ *ngIf=âaddBannerList?.length > 0â>
<ion-slide *ngFor=âlet banner of addBannerListâ (click)=âgotoLayerProfile(banner)â>
This is an Array of objects
addBannerList = [{image: âhttps://matrimonialadvocates.com/public/uploads/promotion/megha.jpg â, id: 637}]
araza
November 1, 2019, 6:38am
#9
I made changes such as
In .ts file
import { Slides, Events } from âionic-angularâ;
@ViewChild (âmySliderâ) slides: Slides; //in class
ionViewWillLeave(){
this.slides.stopAutoplay();
}
ionViewDidEnter() {
this.slides.autoplayDisableOnInteraction = false;
this.slides.startAutoplay();
}
In .html file
<ion-list *ngIf=âaddBannerList?.length > 0â>
<ion-slides pager=âtrueâ #mySlider id=âmySliderâ autoplayDisableOnInteraction = âfalseâ autoplay=â4000â loop=âaddBannerList?.length > 1â>
<ion-slide tappable *ngFor=âlet banner of addBannerListâ>
<img src="{{banner.image}}" (click)=âgotoLayerProfile(banner)â>
Its works for me.
I hope its work for you