2017-12-19 13:53:46 +01:00
|
|
|
import {Component, ElementRef, Input} from '@angular/core';
|
|
|
|
import { SafeResourceUrl, DomSanitizer } from '@angular/platform-browser';
|
|
|
|
//Usage :: <i-frame [url]="url" width="30%" height="250"></i-frame>`
|
|
|
|
@Component({
|
|
|
|
selector: 'i-frame',
|
|
|
|
template: `
|
2019-09-10 13:47:22 +02:00
|
|
|
<div class="iframeContainer uk-height-large" >
|
|
|
|
<iframe [src]="safeUrl"></iframe>
|
|
|
|
</div>
|
|
|
|
|
2017-12-19 13:53:46 +01:00
|
|
|
`
|
|
|
|
})
|
|
|
|
export class IFrameComponent {
|
|
|
|
public safeUrl: SafeResourceUrl;
|
|
|
|
@Input() url ;
|
|
|
|
constructor(private sanitizer: DomSanitizer) {
|
|
|
|
}
|
|
|
|
ngOnInit() {
|
|
|
|
this.safeUrl = this.sanitizer.bypassSecurityTrustResourceUrl(this.url);
|
2019-02-14 11:15:44 +01:00
|
|
|
//console.info("URL:" + this.safeUrl);
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
|
|
|
}
|