Reputation: 179
iframe working while we give direct url it working fine, but we given into dynamic url it does not working, why?
It say error cannot GET/Video
<div *ngIf="video">
<iframe src="video" width="100%" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
</div>
Please give any idea.
Upvotes: 3
Views: 730
Reputation: 44659
You need to use the DomSanitizer
to fix it.
In your .ts code add
import { DomSanitizer } from '@angular/platform-browser';
add it in the constructor
constructor(public domSanitizer: DomSanitizer, ...){...}
and then in the html code it'd be like
<iframe [src]="domSanitizer.bypassSecurityTrustResourceUrl(video)" ...
Upvotes: 2