Leshawn
Leshawn

Reputation: 15

import { AngularFireDatabase, FirebaseListObservable } from “angularfire2/database”;

I'm getting an error that FirebaseListObservable has no imported member. Also, it's saying that import * as firebase from 'firebase/app'; is declared but not use. what's a way I can fix this issue.

import { Injectable } from '@angular/core';

import  'rxjs/add/operator/map';


import { AngularFireAuth } from 'Angularfire2/auth';

import * as firebase from 'firebase/app';

import { AlertController } from 'ionic-angular';

import { Storage} from '@ionic/storage';

import { AngularFireDatabase, FirebaseListObservable } from 'angularfire2/database';




@Injectable()
export class UserServiceProvider {

   items: FirebaseListObservable<any>;

// this will be used to find out if a user has been loggged in then nav to another page
    success: boolean;

  constructor(private afAuth: AngularFireAuth, public alertCtrl: AlertController,
              private storage: Storage, private fbDb: AngularFireDatabase) {

              // This create a refrence to the users in the database
              this.items = fbDb.list('/users')

  }

Upvotes: 1

Views: 3490

Answers (3)

dorona
dorona

Reputation: 11

FirebaseListObservable is no longer used in later versions of angularfire2, try using AngularFireList instead:

    import { AngularFireDatabase, AngularFireList } from 'angularfire2/database';

And then:

    items: AngularFireList<any>;

Upvotes: 1

Shyam Doshi
Shyam Doshi

Reputation: 36

FirebaselistObservable is not used in the recent update.

Instead you need to import the following library:

import { Observable } from 'rxjs/Observable';

and declare items as:

items: Observable<firebase.User>;

Above implementation would resolve your error

Upvotes: 0

Mahesh Jadhav
Mahesh Jadhav

Reputation: 1089

If you are using firebase 4.8.1 try downgrading to 4.8.0:

npm install [email protected]

Upvotes: 0

Related Questions