I have a variable:
public myAccountData;
and this function
setmyAccountData(data){
th=this.authServiceProvider.getData("userbyid/40").subscribe( myData => {
this.myAccountData=myData;
});
}
here’s the getData function:
public getData(type): Observable<any> {
return this.http.get(apiUrl + type);
}
When runnin the get request with userbyid/40 on postman this is what i get
{"id":"40","firstname":"Kebbab","lastname":"Walid","email":"walid@kebbab.fr","username":"walid","password":"a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3","sexe":"","birth":"2018-04-11","telephone":"0","type":"ouvrier","emailverified":"0"}
On the html i tried to use {{myAccountData?.myUsername}} to show the variable’s value but somehow this is not working
I tried to console log the username inside the subsride and it worked