I am working on AngularJS PWA App (Have form in my registration component)
Form have 3 step:
STEP 1
- First Name
- Last Name
- Password
- Phone Number
STEP 2
- example
- example
STEP 3
- example
- example
When my user will finish first step I have radio buttons:
<div class="radio">
<label><input type="radio" name="step2" formControlName="step2" value="1"> Fortsæt</label>
<label><input type="radio" name="step2" formControlName="step2" value="2"> Ring mig op</label>
</div>
Code:
this.rForm.get('step2').valueChanges.subscribe(
(step2) => {
// here I have user registration width angularfire2
this.afAuth.auth.createUserWithEmailAndPassword(email, password).then(function(user) {
}
});
when user click one of radio button, this code will register user in firebase, but if user will click again second radio button, code will try register user again and I am getting error in my console (email alaready exits..).
what is solution for this? I want register user only first time touch to radio button. I am not using here submit, because I have another fields and steps. I want register user only first step.