加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Angular4_ Observable和subscribe

发布时间:2020-12-17 08:36:58 所属栏目:安全 来源:网络整理
导读:getHUs = (request : HandlingUnitsRequest ) : Observable any = { if ( this . chbCheckkAll ) { this . chbCheckkAll . nativeElement .checked = '' ; } const response = this . service . handlingUnits ( request ); response . subscribe ((data : a
getHUs = (request : HandlingUnitsRequest) : Observable< any> => {
if ( this. chbCheckkAll) {
this. chbCheckkAll. nativeElement.checked = '';
}
const response = this. service. handlingUnits( request);
response. subscribe((data : any[]) => {
this. onDataLoaded. emit( data.length !== 0);
console. log( 'getHUsData:' + JSON. stringify( data));
},(err => {
console. log( err);
})
,() => {
console. log( 'SUccessssss');
this. service. handlingUnitFilter(). subscribe((res : any) => {
this. handlingUnitFilter = res;
console. log( res);
});
});
return response;
};
  /**
     * Registers handlers for handling emitted values,error and completions from the observable,and
     *  executes the observable's subscriber function,which will take action to set up the underlying data stream
     * @method subscribe
     * @param {PartialObserver|Function} observerOrNext (optional) either an observer defining all functions to be called,*  or the first of three possible handlers,which is the handler for each value emitted from the observable.
     * @param {Function} error (optional) a handler for a terminal event resulting from an error. If no error handler is provided,*  the error will be thrown as unhandled
     * @param {Function} complete (optional) a handler for a terminal event resulting from successful completion.
     * @return {ISubscription} a subscription reference to the registered handlers
     */
    subscribe(): Subscription;
    subscribe(observer: PartialObserver<T>): Subscription;
    subscribe(next?: (value: T) => void,error?: (error: any) => void,complete?: () => void): Subscription;
    protected _trySubscribe(sink: Subscriber<T>): TeardownLogic;

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读