Reputation: 149
I'm creating an Ionic app where there is a list of information that I want to display, I'm using Firebase as my database (Realtime Database).
But I've been getting this error:
Object(...) is not a function
And I'm not sure why since the code seems fine (I checked angularfire2 git to make sure).
So here's the code:
list.ts
import { Component } from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';
import { AngularFireDatabase } from 'angularfire2/database';
@Component({
selector: 'page-list',
templateUrl: 'list.html'
})
export class ListPage {
informationslist:any;
constructor(public navCtrl: NavController, public navParams: NavParams,
private afDB: AngularFireDatabase) {
try{
this.informationslist = afDB.list('information', (ref) =>
ref.orderByChild('datetime')).valueChanges();
}catch(e){
console.log(e);
}
}
}
list.html
<ion-header>
<ion-navbar>
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title>List</ion-title>
</ion-navbar>
</ion-header>
<ion-content>
<ion-list>
<ion-item *ngFor="let i of informationslist | async">{{i.title}}</ion-item>
</ion-list>
</ion-content>
Upvotes: 0
Views: 2031
Reputation: 165
Can you please provide the version of rxjs. In most cases there could be a problem with the wrong version of it. I think current angularfire2 needs rxjs version 6.0.0 or greater. The full javascript stack could also be useful.
Also if you used another rxjs version before and now try to upgrade consider the migration guide for this: Migration guide rxjs from 5 to 6
Upvotes: 4