<div *ngIf="doc.filePreviewUrl" class='imageDiv' [style.background-image]="getSafeUrl(filePreviewUrl)"></div>
import { DomSanitizer } from '@angular/platform-browser';
constructor(private sanitization: DomSanitizer) { }
// Return trust style
getSafeUrl(filePreviewUrl){
return this.sanitization.bypassSecurityTrustStyle('url(\'' + filePreviewUrl + '\')');
}
.imageDiv{
height: 100%;
background-position: center;
background-repeat: no-repeat;
background-size: contain;
}