I am working on creating variables that can be accessed across all components within my Angular application.
By creating a service that facilitates user connection, I aim to capture user information during the login process and store them in variables that are globally accessible.
My console.log(data.val())
confirms that the data is being properly fetched and displayed.
I am currently using Angular 6 for this project.
retrieveUserInfo(){
firebase.auth().onAuthStateChanged((user) => {
if (user) {
var ref = firebase.database().ref('users/' + user.uid +
'/username').on('value',(data) =>
var username = data.val() ;
);
}
});
}