Code from class:
export class WinsPage { public imgList: any; public loadGallery():void{ let options ={ maximumImagesCount: 20, width: 500, height: 500, quality: 75 }; this.imagePicker.getPictures(options).then(function (result) { for (let i = 0; i < result.length; i++) { this.imgList = [{id: result[i], title: result[i]}]; } }); } Code of the page where I want to process and get data from imgList:
<ion-header> <ion-toolbar> <ion-title>Мои победы</ion-title> <ion-buttons end> <button ion-button icon-only (click)="loadGallery()"> <ion-icon name="ios-add-circle-outline"></ion-icon> </button> </ion-buttons> </ion-toolbar> </ion-header> <ion-content> <ion-grid> <ion-row responsive-sm><!-- responsive-sm = test --> <ion-col col-4 *ngFor="let item of imgList"> <img src="{{item.id}}" (click)="loadWin(item.id)" /> </ion-col> </ion-row> </ion-grid> </ion-content> It doesn’t load img links to images and returns error to console: Error: Uncaught (in promise): TypeError: Cannot read property 'imgList' of undefined imgList is declared. Tried to change to public imgList: [] and public imgList: any [] = []; Anyway error