
实例代码:
this.loading = this.loadingController.create({ content: "<progressbar [max]="100" [value]="100" [type]="info></progressbar>"});this.loading.present(); 问题是Angular 2清洁剂删除了进度条标签,因为(我想)加载内容是在[@R_404_4155@]中注入的.
由于“content”字段只接受字符串,因此我无法绕过Angular 2清理程序(使用DomSanitizer.bypassSecurityTrustHTML).
基本HTML5进度和ng2-boostrap进度条元素都会出现问题.
有谁知道解决方法吗?
我错过了什么吗?
或者它是否应该直接在Ionic中修复?
您可以键入断言任何元素以“关闭”类型检查.
查看代码的评论.
试试以下内容:
export class HomePage { private _HTMLProperty: string = '<progress></progress>'; constructor(public nav: NavController,public loadingCtrl: LoadingController,private _sanitizer: DomSanitizer) { } public HTMLproperty() { return this._sanitizer.bypassSecurityTrustHTML(this._HTMLProperty); } presentLoading() { var HTML = <any> this.HTMLproperty(); // this is the magic let loader = this.loadingCtrl.create({ content: HTML }); loader.present(); }} 从中得到帮助
Is there a way to ignore type incompatibility in typescript?
总结以上是内存溢出为你收集整理的角度 – 离子2:加载组件中的进度条 – InnerHTML清理问题全部内容,希望文章能够帮你解决角度 – 离子2:加载组件中的进度条 – InnerHTML清理问题所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)