1

I'm working on an Ionic 3 app, and I'm trying connect my app to firebase database. but it keeps telling me this:

Type 'AngularFireList<{}>' is not assignable to type 'FirebaseListObservable<any>'. Property '$ref' is missing in type 'AngularFireList<{}>'. (property) AddEmployeePage.employeesList: FirebaseListObservable<any> 

I'm trying to add data to my database and it all goes wrong, here is my typescript code:

import { Component } from '@angular/core'; import { IonicPage, NavController, NavParams } from 'ionic-angular'; import { AngularFireModule } from 'angularfire2'; import { AngularFireDatabase } from 'angularfire2/database'; import { FirebaseListObservable } from 'angularfire2/database-deprecated'; import { EmployeesPage } from './../employees/employees'; @IonicPage() @Component({ selector: 'page-add-employee', templateUrl: 'add-employee.html', }) export class AddEmployeePage { employeesList: FirebaseListObservable<any>; constructor(public navCtrl: NavController, public navParams: NavParams, public angDb: AngularFireDatabase) { this.employeesList = angDb.list('/emloyeesionic'); } addNewEmployee(fname, lname, pos, comp) { this.employeesList.push({ fname: fname, lname: lname, position: pos, company: comp, }).then(newEmployee => { this.navCtrl.push(EmployeesPage) }, error => { console.log(error); }); } } 

Here is a screenshot for the error in my IDE enter image description here

1
  • I didn't add that in the constructor. Thanks for this post! Commented Feb 3, 2020 at 15:05

1 Answer 1

4

I think what you need is

employeesList: AngularFireList<any>; 

instead of

employeesList: FirebaseListObservable<any>; 

Based on the example given here

Sign up to request clarification or add additional context in comments.

2 Comments

Oh my god, that was a miss focusing. The whole day I was on the documentation and I didn't gave it the chance. Thank you really.
Docs need to be a bit more clear on this. Can I have a custom type such as shirts as in the docs here github.com/angular/angularfire2/blob/master/docs/rtdb/…

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.