Hej I have problem with adding AngularFire to constructor at app.component.ts.
I have watching 4 courses realted with AngularFire and everybody add AngularFire to constructor at app.component.ts.
My code look like that:
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'Test App';
constructor(private af: AngularFire){
}
}
VisualCode is telling me that he don't know what is AngularFire. But even if I try add import from angularfire2 I have access only to AngularFireModule
I forget install something or what can be an issue? Yes, I used npm install angularfire --save
答案 0 :(得分:0)
你做错了。您正在安装angularjs版本。使用此
import { AngularFirestore } from 'angularfire2/firestore';
然后在组件中导入它
constructor(db: AngularFirestore) {
}
您的构造函数应该如下所示
PAYMENT CUSTOMER DT_CRIACAO KEY_ORIGEM VL_LIQUIDO
6129385 5026977 29/06/2017 00:00:00 AR_PREV-6129385/14634986 186,48
6129385 5026977 29/06/2017 00:00:00 AR_PREV-6129385/14634985 -35,52
6139889 5033198 29/06/2017 00:00:00 AR_PREV-6139889/14679162 492,94
6139889 5033198 29/06/2017 00:00:00 AR_PREV-6139889/14679163 -93,89
答案 1 :(得分:0)
由于您使用的是Angularfire,因此AngularFire 5.0上没有导出的成员AngularFire。
constructor(afDb: AngularFireDatabase) {
afDb.list<Item>('items').valueChanges().subscribe(console.log);
}
The same concepts apply to FirebaseObjectObservable to AngularFireObject