rxjs5

    0熱度

    1回答

    考慮下面的代碼: this.msgService.getUserChatList() .do((list) => { this.unread = false; console.log(list); }) .mergeMap(chats => Observable.from(chats)) .mergeMap(chat => this.

    6熱度

    2回答

    從我對Angular和RxJs的理解中,有兩種終止Observables的方法。你可以從他們unsubscribe()或使用takeUntil()和complete()。以下是每種方法的示例(僞代碼)。 取消訂閱()方法 private _id: number; private _subscriptions: Subscription[] = []; constructor(private

    4熱度

    1回答

    我試圖在RxJs版本5中使用Observable.interval編寫一個樣本單元測試。我正在運行以下代碼,但是我的observable只觸發一次,而不是預期的20次。 it('does its interval thing synchonously',()=> { let x = []; let scheduler = new Rx.TestScheduler();

    0熱度

    2回答

    我在我建立一個應用程序使用elixir phoenix websocket和我有一個看起來像這樣的史詩: const socketObservable = Observable.create((observer: Object) => { const socket = new Socket(`${getWebSocketUrl()}/socket`, { params: { t

    3熱度

    1回答

    試圖執行是應該下面的代碼: 檢索用戶 的所有聊天記錄的列表獲取最後的消息對所有這些聊天 檢索收件人對於所有這些聊天 全部合併在一起作爲一個數組信息,其中每個項目是聊天的組合,最後的消息和接收者信息 this.msgService.getUserChatList(this.uid).do((chats) => { this.chats = []; if (!(chats.leng

    2熱度

    2回答

    我是RxJS的新手,所以我的術語可能不夠簡潔,對不起。我使用map()創建了派生Observable,並希望它繼續通過其自身傳遞源值以及其他附加事件。例如: //receiving values from server: const $source = new Rx.Subject; //map from network representation to client one: cons

    1熱度

    2回答

    我是新來的角度和開始傾斜的角度4.數據沒有綁定ngfor 指令在組件上使用異步管道。請幫助 用戶的服務使用HTTP請求從API獲取數據: import { Injectable } from '@angular/core'; import { Http, Response, Headers, RequestOptions } from '@angular/http'; import { Obs

    1熱度

    2回答

    我有一個角度4應用程序。在這個應用程序中,我有一個PayPal服務,它執行一些服務器工作並導航(從客戶端)到PayPal。 @Injectable() export class PaypalService { private readonly http: HttpApi; constructor(private readonly httpFactory

    0熱度

    2回答

    正如標題所說,在Angular 2中,有什麼方法可以檢查源是否已經訂閱?因爲我有利用 this.subscription.unsubscribe(); 前檢查呢?這是我的代碼: this.Source = Rx.Observable.timer(startTime, 60000).timeInterval().pluck('interval'); this.Subscription = t

    5熱度

    2回答

    總之: 如何在流錯誤後繼續收聽,而不是在每.subscribe之前加上.catch? 如果您需要更多的細節他們在這裏: 讓我們假設我有當前用戶或空的主題。我有時從API獲取數據併發送給主題。它相應地更新視圖。 但是,在某些時候,我的服務器上發生錯誤,我希望我的應用程序繼續像以前一樣工作,但通知某些地方有關該錯誤並保持聆聽我的主題。 最初我以爲如果我只是做userSubject.error(...)