Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to test a query which returns no result #1236

Closed
Anthony2539 opened this issue Oct 9, 2017 · 2 comments
Closed

How to test a query which returns no result #1236

Anthony2539 opened this issue Oct 9, 2017 · 2 comments

Comments

@Anthony2539
Copy link

I have just migrated to angularfire2 5.0.0-rc.2.

Before I had this :
const searchHashtag = this.searchHashtag(hashtag);
const subscribe = searchHashtag.subscribe(snapshots=>{ if(snapshots.length > 0){ .... }else{ .... }
and now i replace it by this:
const searchHashtag = this.searchHashtag(hashtag);
const subscribe = searchHashtag.snapshotChanges().subscribe(snapshots=>{ if(snapshots.length > 0){ .... }else{ .... }

But when the searchHashtag return no results, the subscribe are no trigger.
How i can fix it ?

thx

@Nebula-Spark
Copy link

Nebula-Spark commented Oct 9, 2017

@Anthony2539
May be Try This,
const searchHashtag = this.db.list('hashtag/').valueChanges()
const subscribe = searchHashtag.subscribe( (snapshots:any)=>{ if(snapshots.length > 0){ .... }else{ .... }

@jamesdaniels
Copy link
Member

Working on it now #1220

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants