title: Angular Not allowed to load local resource: file:///C:/
body: <p>I am using Angular 7 and am trying to sanitize images from the local system in order to be displayed in the chrome browser, but for each method I am getting the error: 
  Not allowed to load local resource: file:///C:/poze/poxulet/poza_profil.jpg [<a href="http://localhost:4200/]" rel="nofollow noreferrer">http://localhost:4200/]</a>.</p>
  
  <p>Does anybody have an idea what could be wrong?</p>
  
  <hr>
  
  <p>This is the first method that I tried: </p>
  
  <p>In template .html</p>
  
  <pre><code>&lt;img mat-card-image [src]="domSanitizer.bypassSecurityTrustUrl(service.image)"/&gt;
  </code></pre>
  
  <p>In component class .ts:</p>
  
  <pre><code>  export class ServicesComponent implements OnInit {
    constructor(public domSanitizer: DomSanitizer) {}
  
    ngOnInit() {
    service.image = "C:/poze/poxulet/poza_profil.jpg";
    }
  </code></pre>
  
  <hr>
  
  <p>This is the second method:</p>
  
  <p>In template .html</p>
  
  <pre><code> &lt;img mat-card-image [src]="getSanitizeUrl(service.image)"/&gt;
  </code></pre>
  
  <p>In component class .ts</p>
  
  <pre><code> export class ServicesComponent implements OnInit {
   constructor(public domSanitizer: DomSanitizer) {}
  
   public getSanitizeUrl(url : string): SafeUrl {
     return this.domSanitizer.bypassSecurityTrustUrl(url);
   }
  
    ngOnInit() {
    service.image = "C:/poze/poxulet/poza_profil.jpg"; }
  </code></pre>