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>