Angularfire: Angularfire2 valueChanges().subscribe is not working in angular 6

Created on 25 Jun 2018  路  5Comments  路  Source: angular/angularfire

"dependencies": {
"@angular/animations": "5.2.11",
"@angular/common": "5.2.11",
"@angular/compiler": "5.2.11",
"@angular/compiler-cli": "5.2.11",
"@angular/core": "5.2.11",
"@angular/forms": "5.2.11",
"@angular/http": "5.2.11",
"@angular/platform-browser": "5.2.11",
"@angular/platform-browser-dynamic": "5.2.11",
"@ionic-native/core": "4.7.0",
"@ionic-native/splash-screen": "4.7.0",
"@ionic-native/status-bar": "4.7.0",
"@ionic/pro": "1.0.20",
"@ionic/storage": "2.1.3",
"angularfire2": "^5.0.0-rc.11",
"firebase": "^5.1.0",
"ionic-angular": "3.9.2",
"ionicons": "3.0.0",
"promise-polyfill": "^8.0.0",
"rxjs": "^5.5.11",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.26"
},

itemsRef: AngularFireList;
items: Observable

constructor(afDb: AngularFireDatabase) {
afDb.list('items').valueChanges().subscribe(console.log);
}

Run time error object is not a function.
polyfills.js:3 Uncaught TypeError: Object(...) is not a function

source: angularfire2/docs/version-5-upgrade.md

Version info

Angular:

Firebase:

AngularFire:

Other (e.g. Ionic/Cordova, Node, browser, operating system):

How to reproduce these conditions

Failing test unit, Plunkr, or JSFiddle demonstrating the problem

Steps to set up and reproduce

Sample data and security rules

<-- include/attach/link to some json sample data (or provide credentials to a sanitized, test Firebase project) -->

Debug output

* Errors in the JavaScript console *

* Output from firebase.database().enableLogging(true); *

* Screenshots *

Expected behavior

Actual behavior

Most helpful comment

npm install rxjs@6 rxjs-compat@6 --save
it solved for me.

All 5 comments

I am getting an error with this too.

this.db.list<Player>("/Players").valueChanges().subscribe((data) => { list = data; });

The error I'm getting in the console is

TypeError: Object(__WEBPACK_IMPORTED_MODULE_1_rxjs__["of"]) is not a function. (In 'Object(__WEBPACK_IMPORTED_MODULE_1_rxjs__["of"])(snapshotAction)', 'Object(__WEBPACK_IMPORTED_MODULE_1_rxjs__["of"])' is an instance of Object)

npm install rxjs@6 rxjs-compat@6 --save
it solved for me.

I believe you must install npm install rxjs@6 rxjs-compat@6 --save @desainr de @cweblogix can both of you try it?

using angularfire2": "^5.0.0-rc.11

got a same error but after installation of rxjs@6 rxjs-compat@6 promise-polyfill

this code work for me !!!

this.db.list('/customers').valueChanges().subscribe((datas) => { console.log("datas", datas) },(err)=>{ console.log("probleme : ", err) });

hello @cweblogix is everything alright? can you close your issue?

Was this page helpful?
0 / 5 - 0 ratings