Skip to content

angularfire2: upgrade: Property 'database' does not exist on type 'AngularFireDatabase' #1155

@magleahy

Description

@magleahy

Version info

Angular: angular/cli: ^1.4.2

Firebase: ^4.3.1

AngularFire: ^4.0.0-rc.2

How to reproduce these conditions

Steps to set up and reproduce
After upgrading my packages, the line: this.db.database.ref throws the error: Property 'database' does not exist on type 'AngularFireDatabase'.

screen shot 2017-09-15 at 10 46 05

Have looked at https://github.com/angular/angularfire2/blob/master/docs/version-4-upgrade.md but when I change the line to this.db.ref it's also not valid as: Property 'ref' does not exist on type 'AngularFireDatabase'.

import * as firebase from 'firebase/app';
import { AngularFireAuth } from 'angularfire2/auth';
import { AngularFireDatabase } from 'angularfire2/database';


@Injectable()
export class AuthService {

  constructor(
    private db: AngularFireDatabase,
    private dbAuth: AngularFireAuth,
  ) {}

  getUser(email) {
    return this.db.database.ref(keys.database.tempUser)
      .orderByChild('email')
      .equalTo(email)
      .limitToFirst(1)
      .once('child_added', (data) => {
        this.setLocalData(keys.localStorage.userIdTemp, data.key);
      });
  }
}

Debug output

Errors in the JavaScript console
Property 'database' does not exist on type 'AngularFireDatabase'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions