How to track pending HTTP requests in angle 2
•
Java
I want angular 1 $HTTP in angular 2 A substitute for pendingrequest or anything that follows the interceptor's global trace It is mainly used to display the load icon when making a call
Solution
I may just keep the icon state and observable hasn't returned yet
Example:
export class MyClass {
private isLoaded = false;
constructor(private myService: MyService){}
ngOnInit(){
this.myService.myServiceCall().subscribe(data => {
console.log(data);
this.isLoaded = true;
});
}
}
Then use * ngif. In the dialog box You can also consider using the asynchronous pipeline provided by angular for the following scenarios:
https://angular.io/docs/ts/latest/api/common/index/AsyncPipe-pipe.html
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码
