Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. import {Component, OnInit} from '@angular/core';
  2. import {FbService} from '../../services/fb/fb.service';
  3. import {Router} from '@angular/router';
  4. import {first} from 'rxjs/operators';
  5.  
  6. @Component({
  7. selector: 'app-signup',
  8. templateUrl: './signup.component.html',
  9. styleUrls: ['./signup.component.css']
  10. })
  11. export class SignupComponent implements OnInit {
  12. errorMessage;
  13.  
  14. constructor(public fb: FbService, public router: Router) {
  15. }
  16.  
  17. ngOnInit() {
  18. }
  19.  
  20. signup(e) {
  21. this.fb.signup(e.target.email.value, e.target.password.value).pipe(first()).subscribe(() => {
  22. this.router.navigateByUrl('');
  23. }, (err) => {
  24. this.errorMessage = err;
  25. setTimeout(() => this.errorMessage = '', 2000);
  26. });
  27. }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement