从typescript访问html变量
请我需要从这个项目中的typescript(在本例中是Prod.firstname)访问HTML变量的帮助。 Prod.firstname来自我的firestore数据收集。 我已经能够在HTML上显示它,但我想在我的typescript文件中访问它,这样我就可以在typescript中的任何地方使用它。但我不知道该怎么做。 我非常感谢任何人的帮助。谢谢。我是个编程新手。 以下是我的html代码:从typescript访问html变量,html,typescript,asynchronous,google-cloud-firestore,ngfor,Html,Typescript,Asynchronous,Google Cloud Firestore,Ngfor,请我需要从这个项目中的typescript(在本例中是Prod.firstname)访问HTML变量的帮助。 Prod.firstname来自我的firestore数据收集。 我已经能够在HTML上显示它,但我想在我的typescript文件中访问它,这样我就可以在typescript中的任何地方使用它。但我不知道该怎么做。 我非常感谢任何人的帮助。谢谢。我是个编程新手。 以下是我的html代码: <ion-card> <ion-card-header>
<ion-card>
<ion-card-header>
<ion-card-title>
First Name:
</ion-card-title>
</ion-card-header>
<ion-card-content>
<div *ngFor="let prod of prodobs| async">
<p>{{prod.firstname}}</p>
</div>
</ion-card-content>
</ion-card>
名字:
{{prod.firstname}
您能否共享您的typescript文件当前的外观?必须在某个位置设置/获取此数据。var prodobs=this.biocollection.doc(this.firstnameholder+“”+this.lastnameholder+“”+this.phonenumberholder)。设置({firstname:this.firstnameholder,lastname:this.lastnameholder,出生日期:this.datetofbirthholder,电话号码:this.phonenumberholder,};非常感谢@paintotpi。我在firestore中从另一个页面创建了一组数据,比如说当前页面(B页)之前的a页,之后我在上面共享的页面(B页)的html上显示了之前在firestore中从a页创建的一些数据(prod.firstname),因此,我现在打算访问在B页的typescript中显示在B页HTML上的数据。上面共享的代码是我最初创建firestore数据的A页的typescript代码: