【发布时间】:2023-04-02 10:25:01
【问题描述】:
我的目标是让学生通过输入提供给他们的代码来注册他/她的 fb/google 帐户。
我如何构建数据
registration-code{
docId: {
code:'52400028'
}
}
provider.ts
checkIfRegistrationCodeExists(userTypedCode:string){
this.registrationCodeCollectionRef = this.afDb.collection('registration-code',
ref => ref.where('code', '==', userTypedCode));
this.registrationCodeCollection = this.registrationCodeCollectionRef.valueChanges();
}
然后我检查它是否匹配
checkIfRegistrationCodeExists(){
console.log(this.userTypedCode);
注册码.ts
this.registrationCodeProvider.checkIfRegistrationCodeExists(this.userTypedCode);
this.registrationCodeProvider.registrationCodeCollection.subscribe(code => {
if(code.length = 1){
console.log('Matched')
} else {
console.log('No matches');
}
})
}
现在我的问题是,我将如何获取相关文档的文档 ID?
关于如何做到这一点的任何提示?谢谢!
【问题讨论】:
标签: angular google-cloud-firestore angularfire2