Hello,
I’m trying to set the background of my ion-content via TS, using ngStyle on html.
the problem is that i’m using bypassSecurityTrustResourceUrl for iOS and it works when try to show it in image but it’s not woking when I try to set it with ng Style , I tried also [Style.background] but it’s showing me Security warning and not showing anything.
Ts part
this.image = this.sanitizer.bypassSecurityTrustResourceUrl(this.webview.convertFileSrc(cordova.file.dataDirectory + img));
This is not showing the image : when I inspect i get background-image ionic://localhost/undefined, I tried also --background.
<ion-content fullscreen class="ion-padding" [ngStyle]="{'background-image':'url('+image+')'}">
This works fine and showing my picture:
<img [src]="image" style="width: 70px; height: 100px;" />
Angular version: 8.1.2
ionic-native/core: 5.0.0
iOS: 13.3.1