0
采取一个页面显示多个图像我试图显示图片陆续从相机离子2采取了同样的页面,但我只能在网页上显示一个图像。 这里是我的代码:从相机采用离子母语离子2
public base64Image: string;
public CompleteImage: Array<{image:string}>;
public OpenCamera() {
Camera.getPicture({
quality: 75,
destinationType: Camera.DestinationType.DATA_URL,
sourceType: Camera.PictureSourceType.CAMERA,
allowEdit: true,
encodingType: Camera.EncodingType.JPEG,
targetWidth: 200,
targetHeight: 200,
saveToPhotoAlbum: false
}).then(imageData => {
alert(1);
this.base64Image = "data:image/jpeg;base64," + imageData;
alert(2);
this.CompleteImage.push(this.base64Image);
alert(this.CompleteImage.length);
}, error => {
console.log("ERROR -> " + JSON.stringify(error));
});
}
的前端 如果我使用此代码
<ion-card *ngIf="base64Image">
<img [src]="base64Image" />
</ion-card>
则显示图像但从集合。如果我试图显示它
<ion-card *ngFor="let i of CompleteImage">
<img [src]="i.image"/>
</ion-card>
然后它不工作。
这是从那里我试图做到这一点的链接。 here
,这并不为我工作。我正在使用离子2 – Majid
会发生什么?应用程序崩溃了吗? –