Google cloud firestore 因为不工作,消防商店
我正在尝试将Angular5用于Firestore的示例,但我无法从Firestore数据库中检索任何数据。任何帮助都将不胜感激,因为这是一场演出。具有讽刺意味的是,我可以使用这个示例将新记录插入数据库,但我无法检索任何内容。提前谢谢 app.component.html:Google cloud firestore 因为不工作,消防商店,google-cloud-firestore,angular5,Google Cloud Firestore,Angular5,我正在尝试将Angular5用于Firestore的示例,但我无法从Firestore数据库中检索任何数据。任何帮助都将不胜感激,因为这是一场演出。具有讽刺意味的是,我可以使用这个示例将新记录插入数据库,但我无法检索任何内容。提前谢谢 app.component.html: <ul *ngFor="let post of posts | async"> <li> <strong>{{ post.title }}</strong>
<ul *ngFor="let post of posts | async">
<li>
<strong>{{ post.title }}</strong>
<br>
{{ post.content }}
</li>
</ul>
看起来像是打字错误:
ngOnit() {
应该是:
ngOnInit() {}
(如果ngAfterContentInit()在生命周期中的该点还没有准备好加载,您甚至可能需要它。)错误在这一行
ngOnInit() {
this.postsCollection = this.afs.collection('posts'); <<HERE
this.posts = this.postsCollection.valueChanges();
}
ngOnInit(){
this.postsCollection=this.afs.collection('posts');
ngOnInit() {}
ngOnInit() {
this.postsCollection = this.afs.collection('posts'); <<HERE
this.posts = this.postsCollection.valueChanges();
}
this.postCollection = this.afs.collection< post > ('posts')