Created
August 8, 2017 19:22
-
-
Save shafiqshams/0c71d8df0b55f80fbeb34a80fce81ad4 to your computer and use it in GitHub Desktop.
To avoid shows console error if the user is not authenticated to get listings from Firebase. [Angular 2 & Firebase App [Part 4] - Firebase Authentication]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit } from '@angular/core'; | |
import { FirebaseService } from '../../services/firebase.service'; | |
@Component({ | |
selector: 'app-listings', | |
templateUrl: './listings.component.html', | |
styleUrls: ['./listings.component.css'] | |
}) | |
export class ListingsComponent implements OnInit { | |
listings:any; | |
constructor(private firebaseService: FirebaseService) { } | |
ngOnInit() { | |
this.firebaseService.getListings().subscribe(listings => { | |
console.log(listings); | |
this.listings = listings; | |
}, err => { | |
console.log(err); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment