Angularjs   发布时间:2022-04-20  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Angular4_ Observable和subscribe大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
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;

大佬总结

以上是大佬教程为你收集整理的Angular4_ Observable和subscribe全部内容,希望文章能够帮你解决Angular4_ Observable和subscribe所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。