psj01
psj01

Reputation: 3245

Getting error saying : [ts] Can not find name 'firebase'

I have an angular app connected to a firebase database. I am able to read data from the database.. however I am trying to enable log in and sign up feature to the app.. But when I try to do

firebase.auth();

I get an error saying [ts] Can not find name 'firebase'

I am trying to follow this video

Am I missing some imports at the top? Currently I have just these...

import { Component } from '@angular/core';
import {AngularFireDatabase} from 'angularfire2/database'

My code inside app.component.ts file :

import { Component } from '@angular/core';
import {AngularFireDatabase} from 'angularfire2/database'

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'app';
  courses:any[];


  constructor(db:AngularFireDatabase)
  {
    db.list('/courses').valueChanges().subscribe(courses=>{
      this.courses = courses;
      console.log(this.courses);
    })


    const auth = firebase.auth(); // -->> ERROR

  }
}

Upvotes: 1

Views: 131

Answers (1)

Robin Dijkhof
Robin Dijkhof

Reputation: 19288

That video is pretty old so there have been some changes. You could downgrade to a version from around the time the video was release. Or you could use the "new" way. Here is an example on authentication. Also, here is the entire changelog.

Upvotes: 1

Related Questions