【发布时间】:2018-01-09 15:43:02
【问题描述】:
我被这个错误困住了。最新版本中似乎不再存在列表方法,我无法获得任何线索来修复此错误。AngularFireObject 类型上也不存在推送方法
import { Component } from '@angular/core';
import { AngularFireDatabase, AngularFireObject } from "angularfire2/database";
import { AngularFireAuth,} from 'angularfire2/auth';
import { Observable } from 'rxjs/Observable';
import * as firebase from 'firebase/app';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
items: AngularFireObject<any>;
name: any;
msgVal: string = '';
title = 'app';
constructor (public afAuth: AngularFireAuth, public af: AngularFireDatabase) {
this.items = af.database.list('/messages', {
query: {
limitToLast: 5
}
});
this.af.auth.subscribe(auth => {
if(auth) {
this.name = auth;
}
});
}
login() {
this.afAuth.auth.signInWithPopup(new firebase.auth.FacebookAuthProvider());
}
chatSend(theirMessage: string) {
this.items.push({ message: theirMessage, name: this.name.facebook.displayName});
this.msgVal = '';
}
}
【问题讨论】:
标签: angular firebase angularfire2