Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70442

Ion Slides does not update

$
0
0

@wardzxzxc wrote:

I wanted to create a set of slides that is binded to an array of images that the user uploads. For each image, I have attached a ‘deleteImage()’ function. However, every time I tried to delete an image, although the length of the image array changes accordingly, the set of slides does not. Would like to check if its a bug or just a case of wrong implementation of the codes.

(In the component file)
deleteImage() {
this.ionSlides.getActiveIndex().then(
index => {
if (index === 0) {
this.images.shift();
this.ionSlides.update().then(() => {
console.log(“updated”);
}
);
}
else {
this.images.splice(index, 1);
this.ionSlides.update().then(() =>
console.log(‘updated’))
}
}
);
}

(In the html file)
<ion-slides pager=“true” *ngIf=“images !== undefined || images.length !== 0”>
<ion-slide *ngFor=“let image of images; let i = index”>


<ion-button shape=“round” color=“danger” size=“small” class=“close” (click)=“deleteImage()”>
×

<ion-img [src]=“image”>


Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70442

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>