Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/33.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
Ajax 如何获取http请求是否在Angular 2中中止?_Ajax_Angular_Http - Fatal编程技术网

Ajax 如何获取http请求是否在Angular 2中中止?

Ajax 如何获取http请求是否在Angular 2中中止?,ajax,angular,http,Ajax,Angular,Http,我使用加载条插件向用户显示是否有http请求。但有时,用户单击一个新路由(我使用angular的路由)和(我猜)angular自动中止http请求。因此,我不知道我应该停止加载杆 我该怎么办 备注:我处理服务文件中的所有http请求。提供相关代码或插件。。取消订阅()将停止http请求。@我知道,我在问如何获取请求是否被取消订阅?。如果http请求被取消订阅,isUnsubscribed将返回false@Sam@Sam您可以参考:提供相关代码或plunker。。unsubscribe()将停止h

我使用加载条插件向用户显示是否有http请求。但有时,用户单击一个新路由(我使用angular的路由)和(我猜)angular自动中止http请求。因此,我不知道我应该停止加载杆

我该怎么办


备注:我处理服务文件中的所有http请求。

提供相关代码或插件。
。取消订阅()
将停止http请求。@我知道,我在问如何获取请求是否被取消订阅?
。如果http请求被取消订阅,isUnsubscribed
将返回
false
@Sam@Sam您可以参考:提供相关代码或plunker。
。unsubscribe()
将停止http请求。@cruengine我知道,我在问如何获取请求是否被取消订阅?
。如果http请求被取消订阅,isUnsubscribed
将返回
false
@Sam@Sam你可以参考: