我在我的项目中使用了@ ng2-loading-bar。
"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();
}
}
知道为什么装载栏不起作用?
它在Firefox浏览器中遇到ajax请求问题。但您可以简单地使用loadingBarService.complete()
来完成加载栏。此功能已存在并在“ng2-loading-bar”包中定义。