Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/32.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
Angular 5 ng2加载条在firefox上无法正常工作_Angular_Firefox_Angular5 - Fatal编程技术网

Angular 5 ng2加载条在firefox上无法正常工作

Angular 5 ng2加载条在firefox上无法正常工作,angular,firefox,angular5,Angular,Firefox,Angular5,我在我的项目中使用了@ng2加载条 "devDependencies": { . . "ng2-loading-bar": "0.0.6", . . } 它可以在Chrome上运行,但不能在Firefox上正常运行。 Firefox中的进度条不完整 import {LoadingBarService} from "ng2-loading-bar"; @Injectable() export class HttpService { constr

我在我的项目中使用了@ng2加载条

"devDependencies": {
    .
    .
    "ng2-loading-bar": "0.0.6",
    .
    .
}
它可以在Chrome上运行,但不能在Firefox上正常运行。 Firefox中的进度条不完整

import {LoadingBarService} from "ng2-loading-bar";

@Injectable()
export class HttpService {

    constructor(private http: Http,
                private loadingBarService: LoadingBarService,
                private logger: Logger,
                private storageService: StorageService,
                private tokenService: TokenService,
                private router: Router) {
    }

    private sendGet(url: string, headers: Headers): Observable<any> {
        headers.append("Content-Type", "application/json");
        headers.append("Accept", "application/json");
        let options = new RequestOptions({headers: headers});
        this.emitStart();

        return this.http.get(url, options)
            .map(this.onComplete)
            .catch((error: any) => this.handleError(error, this));
    }

    private emitStart() {
        this.loadingBarService.start();
    }
}
从“ng2加载条”导入{LoadingBarService};
@可注射()
导出类HttpService{
构造函数(私有http:http,
专用loadingBarService:loadingBarService,
私人记录器:记录器,
专用存储服务:存储服务,
专用令牌服务:令牌服务,
专用路由器(路由器){
}
私有sendGet(url:string,headers:headers):可观察{
headers.append(“内容类型”、“应用程序/json”);
headers.append(“接受”、“应用程序/json”);
let options=newrequestoptions({headers:headers});
这是emitStart();
返回此.http.get(url,选项)
.map(此.onComplete)
.catch((错误:any)=>this.handleError(错误,this));
}
private emitStart(){
这个.loadingBarService.start();
}
}

知道加载栏为什么不工作吗?

它在Firefox浏览器中的ajax请求有问题。 但是您可以简单地使用
loadingBarService.complete()
来完成加载条。
此函数已存在,并在“ng2加载栏”包中定义。

您能否在stackblitz.com或plunkr上提供一个示例?谢谢:)在错误/成功响应中执行loadingBarService.complete()后,它工作正常。