ionic3 - Ionic image picker plugin, showing image not working
问题描述
Im trying to use the image picker for Ionic to select multiple images and show them in an . But I've tried different things and I can't get it to work, I get the image picker and I'm able to select images but I can't get it to show, not in an image tag and not in a slider.
TS function:
addImages() {
let options = {
maximumImagesCount: 10,
outputType: 1
};
this.imagePicker.getPictures(options).then((results) => {
for (var i = 0; i < results.length; i++) {
console.log('Image URI: ' + results[i]);
console.log("Image URI base64? " + results[i])
this.imagePaths.push(results[i]);
}
}, (err) => { console.log("Coulden't get picture") },
);
}
HTML:
<ion-slides class="imageSlider" pager>
<ion-slide [(ngModel)]="imagePaths" *ngFor="let imagePath of imagePaths | async, let i = index">
<img class="img_card" src="{{ imagePath }}" />
</ion-slide>
<ion-slide (click)="addImages()">
<ion-icon name="add"></ion-icon>
<p>Voeg foto's toe van uw woning</p>
</ion-slide>
</ion-slides>
I tried some other things but nothing seems to work, I also tried to navigate to a different page after selecting the image because I thought that maybe there was something wrong with 2 way binding, but that also didn't work.
PS: I'm not getting any errors, the image just isn't added to the slider.
Does anybody have any idea what I'm doing wrong?
Thanks in advance.
解决方案
Stupid mistake, but after 2 days and trying different things I realised that I copy/pasted the ngFor
from another page and still had the |
async part in there.
That's why the images weren't showing up.
But it works now.
推荐阅读
- python - 对象检测torchvision:IOError:[Errno 2]没有这样的文件或目录:
- excel - 通过vba在excel中插入公式的问题
- powerbi - 将多个 pbix 模型组合到一个存储库中
- python - 如何使用 Telethon 获取 Telegram 机器人的相关信息或描述
- css - SVG 元素被切断
- python - 通过引用类的字典属性来理解副本
- php - 在 Laravel 中显示数据库中的数据的问题
- primeng-datatable - Primeng 标题与正文表不对齐
- python - 在 Pycharm/ 中使用 SQLAlchemy 和 Python 连接到 MYSQL AWS-RDS
- c# - 是否可以在 .NET Standard 中使用 System.Drawing.Bitmap 而无需重写代码?