Skip to main content

Posts

Featured

Getting list of data with $key using angularfire2, firebase, async pipe and Angular 5+

Hi, The angularfire2 is updated. It made some changes with compare to its previous version 4.X. In new update of angularfire2, they replaced FirebaseListObservable with AngularFireList that we were using to get all data list from firebase. There is also updates in .valueChanges(). Calling .valueChanges() returns an Observable without any metadata, so you cannot get $key from it. Now if you want to get $key then you need to use snapshotChanges(); Please check the changes here - https://github.com/angular/angularfire2/blob/master/docs/version-5-upgrade.md Now to get key with data, I am showing you example code here – Let s assume I have a document named categories. 1- Create a new service named category $ng g s category 2- Add category service in your provider in file “app.module.ts” export class CategoryService { //create a variable with type of Observable because snapshotChanges returns a observable type. observableCategories$: Observable < any > ; // injec

Latest Posts

Updating Angular CLI version to create latest version angular app

Signup with email verification using Mailgun SMTP, bcrypt & nodemailer in MEAN Stack

PHP Pagination Using Mysql Database

Getting Page Contents Using PHP Curl

Encoding Latin Character By PHP