src iframe error

0

My code:

<div class="col-md-3 col-sm-4 col-xs-6" *ngFor="let g of gag">
    <div *ngIf="g.tipo == 2">
      <iframe width="280" height="162" [src]="g.caminho" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen ></iframe>
    </div>
</div>

and the error displayed in the console:

ERROR Error: unsafe value used in a resource URL context (see http://g.co/ng/security#xss)
at DomSanitizerImpl.push../node_modules/@angular/platform-browser/fesm5/platform-browser.js.DomSanitizerImpl.sanitize (platform-browser.js:1812)
at setElementProperty (core.js:8260)
at checkAndUpdateElementValue (core.js:8212)
at checkAndUpdateElementInline (core.js:8159)
at checkAndUpdateNodeInline (core.js:10503)
at checkAndUpdateNode (core.js:10469)
at debugCheckAndUpdateNode (core.js:11102)
at debugCheckRenderNodeFn (core.js:11088)
at Object.eval [as updateRenderer] (GaleriaComponent.html:24)

Does anyone know how to fix the error?

    
asked by anonymous 29.10.2018 / 07:04

1 answer

1

The problem is in [src]="g.caminho" , you should not go that way.

More information: link

    
29.10.2018 / 13:24