我正在一个包含Angular 7和AngularFire 2库的项目
这里的要求是从Firestore Collection中获取一个对象,并检索其属性或值,然后将这些值映射到在Typescript中创建的Model类。
请在下面找到演示代码,
openAddEmpModal: boolean = false;
IdConfigurationCollection: Observable<IdConfiguration[]>;
IdConfigurationDocument: AngularFirestoreDocument<IdConfiguration>;
userId: IdConfiguration;
idconfig: DocumentData;
getDoc() {
this.IdConfigurationDocument = this.afs.doc<IdConfiguration>
(Firestorecollectionconstant.IDConfigurationCollection+'/use-');
// console.log(JSON.stringify());
this.idconfig = this.IdConfigurationDocument.get().subscribe(data =>
console.log('firebase object while getting process'+data.data()));
}
我需要将idconfig:DocumentData的值映射到userid:IdConfiguration.ts
预先感谢;