openaire-library/utils/iframe.component.ts

23 lines
647 B
TypeScript

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: `
<div class="iframeContainer uk-height-large" >
<iframe [src]="safeUrl"></iframe>
</div>
`
})
export class IFrameComponent {
public safeUrl: SafeResourceUrl;
@Input() url ;
constructor(private sanitizer: DomSanitizer) {
}
ngOnInit() {
this.safeUrl = this.sanitizer.bypassSecurityTrustResourceUrl(this.url);
//console.info("URL:" + this.safeUrl);
}
}