0
Well, I’m doing an Angular course, I’m trying to understand the concept of Observables and Promisses, but I’m a little confused, I’m using Firebase to create a simple application, where I use email authentication and password
and to save the other user data I have to use the id of this authenticated user and register in the Database.
Having done so I have to use the method of my service that creates this user and then use the method that saves the data.
Following this order I have to do the method of SignUp(email,senha)
be executed before the method setUserData(User)
.
> Metodos
SetUserData(user) {
const itemsRef = this.db.object(`usu/${user.uid}`);
return itemsRef.set(user);
}
SignUp(email, password) {
return this.afAuth.auth.createUserWithEmailAndPassword(email, password)
.then((result) => {
this.SendVerificationMail();
window.alert("BEM VINDO");
}).catch((error) => {
window.alert(error.message)
})
}
Note: The methods are called in the component where I do the two-way data Binding with the form using an onsubmit method'
Thank you very much, man, it worked here, I gave a good and good, it worked perfectly
– Junior De Souza