当先锋百科网

首页 1 2 3 4 5 6 7

遇到问题 百度了一波  先变为自己的再说  = =

 

1、导入依赖

import { DomSanitizer } from '@angular/platform-browser';

2、获取地址

地址类型要定义为any

private CreditRuleUrl: any = AppConfig.CREDIT_RULE_URL(html的地址)

constructor(

public navCtrl: NavController,

public nativeService: NativeService,

public navParams: NavParams,

private sanitizer: DomSanitizer) {

this.CreditRuleUrl = this.sanitizer.bypassSecurityTrustResourceUrl(this.CreditRuleUrl);

}

3、html文件中

<iframe [src]=CreditRuleUrl id="credit_iframe" (load)="iframeLoad()"></iframe>