0
我將我的應用程序連接到使用AngularFire2包的Firebase。我知道這是勾搭上了,因爲當我做了一個組件如下:在AngularFire2中獲取FirebaseListObservable
constructor(af: AngularFire) {
this.items = af.database.list('/items');
this.items.push({ attr: 'value' });
}
的項目推到火力地堡正確的名單。所以連接就在那裏。但是,當嘗試循環並在模板中顯示它們時,this.items爲空。還需要做什麼才能顯示這些項目?
<div *ngFor="let item of items | async">{{ item.attr }}</div>
編輯
下面是實際的代碼要點的鏈接,但它確實幾乎完全一樣的東西在這裏這個問題。
https://gist.github.com/pjlamb12/0c3c680e3481c222f9b253224c7dd439