Guest User

Untitled

a guest
Jan 4th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. import { Component, OnInit } from '@angular/core';
  2. import { AuthService } from '../services/auth.service';
  3. import { Router } from '@angular/router';
  4.  
  5. @Component({
  6. selector: 'app-signup-form',
  7. templateUrl: './signup-form.component.html',
  8. styleUrls: ['./signup-form.component.css']
  9. })
  10. export class SignupFormComponent implements OnInit {
  11. email: string;
  12. password: string;
  13. userName: string;
  14. errorMessage: string;
  15.  
  16. constructor(private authService: AuthService, private router: Router) { }
  17.  
  18. ngOnInit() {
  19. }
  20. signup() {
  21. const email = this.email;
  22. const password = this.password;
  23. const userName = this.userName;
  24. this.authService.signup(email, userName, password)
  25. .then(resolve => this.router.navigate(['chat']))
  26. .catch (
  27. error => this.errorMessage = error.message
  28. );
  29. }
  30. }
Add Comment
Please, Sign In to add comment