I have tried to follow the Angular2 setup steps to the letter, but am having a bit of trouble with an error in the console:
ERROR Error: Uncaught (in promise): Error: No provider for AngularFireDatabase!
sign-in.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { SignInComponent } from './sign-in.component';
import { AngularFireModule } from 'angularfire2';
import { fireBaseEnvironment } from '../environment';
import { AngularFireDatabaseModule } from 'angularfire2/database';
import { AngularFireAuthModule } from 'angularfire2/auth';
@NgModule({
imports: [
BrowserModule,
AngularFireModule.initializeApp(fireBaseEnvironment.firebase, 'my-app-name'), // imports firebase/app needed for everything
AngularFireDatabaseModule, // imports firebase/database, only needed for database features
AngularFireAuthModule, // imports firebase/auth, only needed for auth features
],
declarations: [ SignInComponent ],
bootstrap: [ SignInComponent ]
})
export class SignInModule {}
sign-in.component.ts
import {
Component,
OnInit
} from '@angular/core';
import { AngularFireDatabase, FirebaseListObservable } from 'angularfire2/database';
@Component({
selector: 'sign-in',
template: `
<p> Hi, this is the sign in bits jimmy</p>
<p>Click this to go to another place <a [routerLink]=" ['../detail'] " >Detail</a>
<ul>
<li class="text" *ngFor="let item of items | async">
{{item.$value}}
</li>
</ul>
`
})
export class SignInComponent {
public jimmy: 'testing';
public items: FirebaseListObservable<any[]>;
constructor(db: AngularFireDatabase) {
this.items = db.list('/items');
}
}
Any ideas lovely people?