Skip to content

Instantly share code, notes, and snippets.

@hamedbaatour
Created August 6, 2019 08:43
Show Gist options
  • Save hamedbaatour/d126a561076b86d9c04274930f21bee4 to your computer and use it in GitHub Desktop.
Save hamedbaatour/d126a561076b86d9c04274930f21bee4 to your computer and use it in GitHub Desktop.
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