saveDetails(){
this.afAuth.authState.take(1).subscribe(auth => {
this.af.object('request/${auth.uid}').set(this.request)
.then();
})
After executing this method, an error: Firebase.child failed: First argument was an invalid path: "request/${auth.uid}". Paths must be non-empty strings and can't contain ".", "#", "$", "[", or "]" is being shown. Tried removing $ but that doesn't work. Pretty sure i am not passing in empty strings too.
If you are going to use string interpolation, you need to use back ticks (`), and not single quotes ('), to wrap a string. See below.
saveDetails(){
this.afAuth.authState.take(1).subscribe(auth => {
this.af.object(`request/${auth.uid}`).set(this.request)
.then();
})
Easy one to forget! :)
The correct way to use your variable in this context is this
saveDetails(){
this.afAuth.authState.take(1).subscribe(auth => {
this.af.object('request/'+ auth.uid).set(this.request)
.then();
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With