Project

General

Profile

1
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
    <div  class="iframeContainer uk-height-large" >
8
      <iframe [src]="safeUrl"></iframe>  
9
    </div>
10
    
11
  `
12
})
13
export class IFrameComponent {
14
  public safeUrl: SafeResourceUrl;
15
  @Input() url ;
16
  constructor(private sanitizer: DomSanitizer) {
17
  }
18
  ngOnInit() {
19
    this.safeUrl = this.sanitizer.bypassSecurityTrustResourceUrl(this.url);
20
    //console.info("URL:" + this.safeUrl);
21
  }
22
}
(9-9/18)