'query' does not exist in type 'QueryFn' | angularfire2

后端 未结 5 1288
渐次进展
渐次进展 2021-02-09 04:18

Argument of type \'{ query: { limitTolast: number; orderByKey: boolean; }; }\' is not assignable to parameter of type \'QueryFn\'.Object literal may only specify known propertie

5条回答
  •  半阙折子戏
    2021-02-09 05:15

    It's not working, because AngularFire expects a function to be passed as a second argument.

    I think your example was the right way to go during the beta version. (not 100% sure)

    You have use it the following way:

    // make sure to provide a child in the orderByChild call
    getMessages(): Observable {
        return this.db.list('/messages', ref => {
          return ref.limitTolast(25).orderByKey(true)
        });
      }
    

    Learn more about querying lists here: https://github.com/angular/angularfire2/blob/master/docs/rtdb/querying-lists.md

提交回复
热议问题