尝试访问HTML

时间:2017-11-06 09:22:56

标签: angular firebase google-cloud-firestore

我正在尝试访问模板中的Firestore变量,但它显示为空。有没有人知道如何使这个工作?

HTML

<a class="header">{{submissions[0]?.UsersName}}</a>

打字稿

this.submissionsCollection = this.afs.collection(pathSubmissions);
this.submissions = this.submissionsCollection.valueChanges();

submissionsCollection: AngularFirestoreCollection<Submission>;
submissions: Observable<Submission[]>;

2 个答案:

答案 0 :(得分:0)

这会奏效:

<a class="header">{{(submissions| async )[0]?.UsersName}}</a>

如果你想在NgFor中使用它:

  <a *ngFor="let submission of submissions | async"> {{submission?.UsersName}} </a> 

答案 1 :(得分:0)

试试这个

$ cat test.out 

SQL*Plus: Release 11.2.0.4.0 Production on Mon Nov 6 15:12:05 2017

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> 
D
-
X

SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options