angular 中断HTTP请求
由于angular的HTTP请求返回promise类型的数据,通过subscribe()方法来接收返回数据,因此可以通过调用取消订阅 unsubscribe()方法来实现中断HTTP请求。实现方法用例:subscribes:any;getChannels() {}this.subscribes = this._service.getChannels(connectionName).subscrib
·
由于angular的HTTP请求返回promise类型的数据,通过subscribe()方法来接收返回数据,因此可以通过调用取消订阅 unsubscribe()方法来实现中断HTTP请求。
实现方法用例:
subscribes:any;
getChannels() {
}
this.subscribes = this._service.getChannels(connectionName).subscribe((channels: any) => {
如果是通过循环调用HTTP请求,
更多推荐
所有评论(0)