Javascript Ionic 3-innerHtml未在android上加载图像
我正在从WordPress网站获取一些数据。这需要在应用程序中显示。正在加载所有HTML。但是图像没有加载。我已经在很多android设备上测试过了。这是我的密码: HTMLJavascript Ionic 3-innerHtml未在android上加载图像,javascript,angular,cordova,ionic3,Javascript,Angular,Cordova,Ionic3,我正在从WordPress网站获取一些数据。这需要在应用程序中显示。正在加载所有HTML。但是图像没有加载。我已经在很多android设备上测试过了。这是我的密码: HTML <div id="post-details" [class]="'post-details-'+post.id" [innerHtml]="post.post_content | safe"></div> 控制台中有错误吗?您是否使用内容安全策略?您是否尝试过在没有SafePipe的情况下显示图像
<div id="post-details" [class]="'post-details-'+post.id" [innerHtml]="post.post_content | safe"></div>
控制台中有错误吗?您是否使用内容安全策略?您是否尝试过在没有SafePipe的情况下显示图像?控制台中没有错误。它正在浏览器上工作。但不能在移动设备上工作。
import { Pipe } from '@angular/core';
import { DomSanitizer, SafeHtml, SafeStyle, SafeScript, SafeUrl, SafeResourceUrl } from '@angular/platform-browser';
@Pipe({
name: 'safe'
})
export class SafePipe {
constructor(protected _sanitizer: DomSanitizer) {
}
public transform(value: string, type: string = 'html'): SafeHtml | SafeStyle | SafeScript | SafeUrl | SafeResourceUrl {
switch (type) {
case 'html': return this._sanitizer.bypassSecurityTrustHtml(value);
case 'style': return this._sanitizer.bypassSecurityTrustStyle(value);
case 'script': return this._sanitizer.bypassSecurityTrustScript(value);
case 'url': return this._sanitizer.bypassSecurityTrustUrl(value);
case 'resourceUrl': return this._sanitizer.bypassSecurityTrustResourceUrl(value);
default: throw new Error(`Invalid safe type specified: ${type}`);
}
}
}