I have this call inside my html file:
profile.html
<div mat-card-avatar *ngIf="imgResult" [ngStyle]="{ 'background-image': 'url(' + imgResult + ')' }" class="avatar">
  <mat-icon *ngIf="!imgResult">person</mat-icon>
</div>
My component is like this:
profile.component.ts
import { DomSanitizer } from '@angular/platform-browser';
...
  picture: File;
  imgResult: any;
...
constructor(
    private sanitizer: DomSanitizer
  ) { }
...
  onChange(event) {
    this.picture= event.target.files[0];
    const reader = new FileReader();
    reader.readAsDataURL(this.picture);
    reader.onload = (ev: any) => {
      this.imgResult = ev.target.result;
      return this.sanitizer.bypassSecurityTrustUrl(this.imgResult);
    };
  }
The picture load is working as expected but, I can't stop the sanitizing unsafe URL value warning.
How can I do that?
 
    