The part [style.background-image]="'url('+ file.objectURL +')'"
doesn't seem to work and no error is returned. Using the variable file from ng-template's let-file works fine inside [src] of this line <img *ngIf="file.type.startsWith('image')" [src]="file.objectURL>"
but doesn't seem to work inside [style.background-image]
. Any help much appreciated. Thanks!
<ng-template let-file pTemplate="file">
<div class="ui-fileupload-row">
<div style="text-align: center;">
<img *ngIf="file.type.startsWith('image')" [src]="file.objectURL" width="150"/> /** This works fine **/
<i *ngIf="!file.type.startsWith('image')" class="pi pi-file"></i>
</div>
<div style="height: 50px">
<div
[style.background-image]="'url('+ file.objectURL +')'" /** This doesn't work **/
[style.background-size]="'cover'"
[style.width.px]="200"
[style.height]="'inherit'"></div>
</div>
</div>
</ng-template>
file.objectURL contains blob:http://6hjqmn2.yyy.com:8014/27fffed1-5d30-49f1-bfee-935f56a2ec24