1 |
50169
|
argiro.kok
|
import {Component, ElementRef, Input} from '@angular/core';
|
2 |
|
|
import { SafeResourceUrl, DomSanitizer } from '@angular/platform-browser';
|
3 |
|
|
//Usage :: <i-frame [url]="url" width="30%" height="250"></i-frame>`
|
4 |
|
|
@Component({
|
5 |
|
|
selector: 'i-frame',
|
6 |
|
|
template: `
|
7 |
|
|
<iframe [width]="width" [height]="height" [src]="safeUrl"></iframe>
|
8 |
|
|
`
|
9 |
|
|
})
|
10 |
|
|
export class IFrameComponent {
|
11 |
|
|
public safeUrl: SafeResourceUrl;
|
12 |
|
|
@Input() url ;
|
13 |
|
|
@Input() width = '100%';
|
14 |
|
|
@Input() height = '300';
|
15 |
|
|
constructor(private sanitizer: DomSanitizer) {
|
16 |
|
|
}
|
17 |
|
|
ngOnInit() {
|
18 |
|
|
this.safeUrl = this.sanitizer.bypassSecurityTrustResourceUrl(this.url);
|
19 |
54775
|
konstantin
|
//console.info("URL:" + this.safeUrl);
|
20 |
50169
|
argiro.kok
|
}
|
21 |
|
|
}
|