Image Swipe doesn't working with APIRest

plugins

#1

Hi!

I’m trying to use the plugin calling the images from an APIRest, the next is the code inside the component.ts

public items: any[] = [];
public pageNumber = 0;

constructor( private api: ApiService) { }

ngOnInit() {
this.api.getImages()
.subscribe(
(response) => {
response.forEach(element => {
this.items.push({ imageUrl: element.image });
});
},
() => alert("Unfortunately we were unable to get images.")
);
}

And this is the html code:

<ImageSwipe [items]="items" imageUrlProperty="imageUrl"
[pageNumber]="pageNumber" (pageChanged)="pageChanged($event)" allowZoom="false" backgroundColor="#000000">

When I run the application on an Android emulator y get the next error:

The application’s PagerAdapter changed the adapter’s contents without calling PagerAdapter#notifyDataSetChanged! Expected adapter item count: 0, found: 2

Any help would be very appreciated!!


#2

hi, have you contacted the plugin author? I’m guessing @peter.staev


#3

Hi, yes I wrote on the GitHub page of the project, but I haven’t gotten an answer yet.


#4

Hey! I’ve just responded to the issue. You can take a look for a fix there :slight_smile:


#5

Hey I just saw it and it worked!!! Thank you so much to all of you for taking care of the community