Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Ionic 3-innerHtml未在android上加载图像_Javascript_Angular_Cordova_Ionic3 - Fatal编程技术网

Javascript Ionic 3-innerHtml未在android上加载图像

Javascript 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的情况下显示图像

我正在从WordPress网站获取一些数据。这需要在应用程序中显示。正在加载所有HTML。但是图像没有加载。我已经在很多android设备上测试过了。这是我的密码:

HTML

<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}`);
    }
}

}