如何使用iframe标签打开一个新窗口和里面显示的facebook页面?

时间:2017-03-16 11:48:00

标签: html angular iframe

我是angular2的新手,我创建了angular2应用程序。

我的angular2应用程序有一些问题(对不起我的英语语言)..(查看图片
1.i显示父窗口,然后单击父窗口按钮打开一个新窗口,这样工作正常 但是,我尝试使用 iframe标记在新窗口中显示http://www.facebook页面。但是,没有解决它  任何人都可以帮助我! 的 parent.component.html

<div><a href="javascript:void(0);" (click)="window.open()">click Me</a></div>
<iframe #window="child"></iframe>

child.component.ts

import { Component } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { DomSanitizer } from "@angular/platform-browser";

@Component({
    selector: 'iframe',
    template: `<div>
    <h4>Angular2 app </h4>
     <iframe width="100%" height="300" [src]="pdfUrl"></iframe>
    </div>`,
    exportAs: 'child',
})
export class IframeComponent {
    pdfUrl;
    constructor(private domSanitizer: DomSanitizer) { 
  this.pdfUrl = this.domSanitizer.bypassSecurityTrustResourceUrl('https://www.facebook.co'); // how to dispaly the inside window?
    }

    open() {
        window.open('http://localhost:4200/SEA/mainpage','_blank', 'location=yes,height=570,width=520,scrollbars=yes,status=yes')     //this is working fine
    }
}

enter image description here

0 个答案:

没有答案