1
votes

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!joshlsullivan

1 Answers

4
votes

I think what you need is

employeesList: AngularFireList<any>;

instead of

employeesList: FirebaseListObservable<any>;

Based on the example given here