Property 'filter' does not exist on type 'FirebaseListObservable'

谁说我不能喝 提交于 2019-12-07 07:23:40

问题


I am using Ionic 2 and Firebase to build a chat app.

I add the following which is supposed to be used to add a filter:

import 'rxjs/add/operator/filter';
        ...
public af: AngularFire
        ...
    this.firelist = this.af.database.list('/chat/', {
      query: {
        orderByChild: 'negativtimestamp'
      }
    }).filter(item => item.memberIds === 'xxx');

However, I get the following:

[ts] Property 'filter' does not exist on type 'FirebaseListObservable'.

ps. this.af.database.list(...) returns a FirebaseListObservable<any[]>. filter can be done on Observable but not on FirebaseListObservable.

Question

So how do I implement the filter on FirebaseListObservable because class FirebaseListObservable<T> extends Observable<T>?

Also

import 'rxjs/add/operator/map'
            ...
    this.af.database.list('').map(item => {});

has the following error:

[ts] Property 'map' does not exist on type 'FirebaseListObservable'.

More Info:

My package.json has:

 "rxjs": "5.0.0-beta.12",

Any help appreciated.

UPDATE

If you look at the following youtube tutorial, they do exactly what I want to achieve, but without the errors. Does anyone know why I get errors? I am using "angularfire2": "^2.0.0-beta.7-pre",.


回答1:


This issue was fixed in the following version:

"angularfire2": "^2.0.0-beta.7.1-pre",

Solution:

npm install firebase angularfire2@^2.0.0-beta.7.1-pre --save



来源:https://stackoverflow.com/questions/41550132/property-filter-does-not-exist-on-type-firebaselistobservable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!