Created
August 6, 2019 08:43
-
-
Save hamedbaatour/d126a561076b86d9c04274930f21bee4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Component, OnInit} from '@angular/core'; | |
import {FbService} from '../../services/fb/fb.service'; | |
import {Router} from '@angular/router'; | |
import {first} from 'rxjs/operators'; | |
@Component({ | |
selector: 'app-signup', | |
templateUrl: './signup.component.html', | |
styleUrls: ['./signup.component.css'] | |
}) | |
export class SignupComponent implements OnInit { | |
errorMessage; | |
constructor(public fb: FbService, public router: Router) { | |
} | |
ngOnInit() { | |
} | |
signup(e) { | |
this.fb.signup(e.target.email.value, e.target.password.value).pipe(first()).subscribe(() => { | |
this.router.navigateByUrl(''); | |
}, (err) => { | |
this.errorMessage = err; | |
setTimeout(() => this.errorMessage = '', 2000); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment