How to convert url to secure url link that can be recognized by iframe in angular
<iframe src="{{url}}"></iframe>
How to convert url to secure url link that can be recognized by iframe in angular
<iframe src="{{url}}"></iframe>
Try like this below
secure-pipe.ts
import { Pipe, PipeTransform } from '@angular/core';
import { DomSanitizer} from '@angular/platform-browser';
@Pipe({ name: 'secure' })
export class SecurePipe implements PipeTransform {
constructor(private sanitizer: DomSanitizer) {}
transform(url) {
return this.sanitizer.bypassSecurityTrustResourceUrl(url);
}
}
app.module.ts
@NgModule({
declarations : [
...
SecurePipe
],
})
In Html
<iframe [src]="url | secure"></iframe>