遇到问题 百度了一波 先变为自己的再说 = =
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>