簡體   English   中英

錯誤TypeError:Observable_1.Observable.combineLatest不是函數

[英]ERROR TypeError: Observable_1.Observable.combineLatest is not a function

我正在使用Angular 5.2和Rxjs 5.6-forward-compat.3。

我正在嘗試合並兩個Firestore集合,但我認為該問題與導入有關,但是我已經嘗試了所有可能的組合和選項,因此不確定。

Here is the code:`IMPORTS: 
import 'rxjs/add/operator/mergeMap';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/combineLatest';

Here is my observable:
getActiveMedicationandCompliance(start: any): Observable<any[]> {
    const email = this.authService.getLoginUserid();
    const userDoc = this.afs.doc<User>(`users/${email}`);

    return userDoc
      .collection<any>(collection.MY_MEDICATION_CABINET, ref =>
        ref.where('active', '==', true).orderBy('medicationName', 'asc')
      )
      .snapshotChanges()
      .map(changes => {
        return changes.map(action => {
          let data = action.payload.doc.data();
          data.id = action.payload.doc.id;
          return userDoc
            .collection<any>(collection.MY_MEDICATION_COMPLIANCE, ref =>
              ref
                .where('medicationCabinetId', '==', data.id)
                .where('createdDate', '>=', start)
                .orderBy('createdDate', 'asc')
            )
            .snapshotChanges()
            .map(changes => {
              changes.map(action => {
                const dataCompliance = action.payload.doc.data();
                dataCompliance.id = action.payload.doc.id;
                return (data = Object.assign(
                  {},
                  { ...dataCompliance, ...data }
                ));
              });
            });
        });
      })
      .mergeMap(observables => Observable.combineLatest(observables));
  }
`

CombineLatest不是運算符,而是可觀察的導入的一部分:

import 'rxjs/observable/combineLatest';

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM