Ad
I Keep Getting The Error: Error: Too Many Arguments Provided To Query.startAt(). When Using AngularFire2
I have a simple function that accepts parameters and returns the dataset
search(searchValues , numOfItems, startKey?) {
return this.db.collection('gppContract', ref => ref
.where('financialYear', '==', searchValues.financialYear)
.startAt(startKey)
.orderBy('amount', 'desc')
.limit(numOfItems + 1))
.valueChanges();
}
What am i doing wrong or missing? am at a loss here.
Ad
Answer
First, orderBy()
needs to be before startAt()
, to know according to which node the result should be.
Second, orderBy()
only takes one argument and it should be the same field as where()
, from the docs:
Range filter and orderBy should be on the same fields:
citiesRef.where("population", ">", 100000).orderBy("population")
Check this:
https://github.com/angular/angularfire2/blob/master/docs/firestore/querying-collections.md
Ad
source: stackoverflow.com
Related Questions
- → Make a Laravel collection into angular array (octobercms)
- → Laravel {!! Form::open() !!} doesn't work within AngularJS
- → Angularjs not working inside laravel form
- → Analysis of Flux implementations
- → how to write react component to construct HTML DOM
- → angular ng-repeat and images in a row
- → Conditional BG Color on AngularJS
- → Should I 'use strict' for every single javascript function I write?
- → getting the correct record in Angular with a json feed and passed data
- → "Undefined is not a function" at .toBe fucntion
- → angularjs data binding issue
- → Angular / JavaScript auto hydrate an instance
- → Convert generic text string in json object into valid url using Angular
Ad