When manually assigning the userid within the path
this.afData.object('Usuários/pqMaisUMrWUrk8v8TZmvzQjd1H82/Dados Pessoais/typeuser')
Full function:
constructor(
public navCtrl: NavController,
private afData: AngularFireDatabase,
private afAuth: AngularFireAuth) {
this.afAuth.authState.subscribe(user => {
if(user) this.userId = user.uid})
this.afData.object('Usuários/pqMaisUMrWUrk8v8TZmvzQjd1H82/Dados Pessoais/typeuser')
.valueChanges()
.subscribe(dataclient=>{
console.log(dataclient)
this.typeUser=dataclient;
});
}
I can receive the Child value "typeuser" and store it in a variable.
![inserir a descrição da imagem aqui](https://i.stack.imgur.com/rdlAU.png)
But when I put the userid variable (as described below) I get "null" as return.
this.afData.object('Usuários/'+this.userId+'/Dados Pessoais/typeuser')
Full function:
constructor(
public navCtrl: NavController,
private afData: AngularFireDatabase,
private afAuth: AngularFireAuth) {
this.afAuth.authState.subscribe(user => {
if(user) this.userId = user.uid})
this.afData.object('Usuários/'+this.userId+'/Dados Pessoais/typeuser')
.valueChanges()
.subscribe(dataclient=>{
console.log(dataclient)
this.typeUser=dataclient;
});
}
![](https://i.stack.imgur.com/PNI0h.png)
Avoid displaying your code through images.
– Leandro Angelo
Thanks for the tip Leandro! It was my first post, I did not know the tools that the site has to publish the code! Now I know!
– Igor Gabriel