Я создал ion-card
, который отображает как изображения, так и документы, хранящиеся в приложении. Я пытаюсь выключить ion-thumbnail
, когда [src]="img.path"
пуст. Я пробовал *ngIf != "[src]= ''"
на ion-thumbnail
, но без радости.
. html
<ion-card>
<ion-card-content>
<div class = "fileButtons">
<ion-button fill="outline" (click)="selectImage()">
Add Photo
<ion-icon slot="start" name="camera"></ion-icon>
</ion-button>
<ion-button fill="outline" (click)="getFile()">
Add Files
<ion-icon slot="start" name="document"></ion-icon>
</ion-button>
</div>
<ion-list>
<ion-item *ngFor="let img of images; index as pos" class="ion-text-wrap">
<ion-thumbnail slot="start" *ngIf !="[src]= ' '">
<ion-img [src]="img.path" alt="No preview"></ion-img>
</ion-thumbnail>
<ion-textarea auto-grow="true" >{{ img.name }}</ion-textarea>
<ion-button slot="end" fill="clear" (click)="deleteImage(img, pos)">
<ion-icon slot="icon-only" name="trash"></ion-icon>
</ion-button>
</ion-item>
</ion-list>
</ion-card-content>
</ion-card>
.ts
loadStoredImages_Documents() {
this.storage.get(this.STORAGE_KEY).then(images => {
if (images) {
let arr = JSON.parse(images);
this.images = [];
arr = arr.filter(a => a.includes("questionid_" + this.sectionUUID));
for (let img of arr) {
let filePath = this.file.dataDirectory + img;
let resPath = this.pathForImage(filePath);
this.images.push({ name: img, path: resPath, filePath: filePath });
}
}
});
}