Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. import { Component, OnInit } from '@angular/core';
  2. import { ValidateService } from '../../services/validate.service'
  3.  
  4. @Component({
  5. selector: 'app-register',
  6. templateUrl: './register.component.html',
  7. styleUrls: ['./register.component.css']
  8. })
  9. export class RegisterComponent implements OnInit {
  10. name: String;
  11. username: String;
  12. email: String;
  13. password: String;
  14.  
  15. constructor(private validateService: ValidateService) { }
  16.  
  17. ngOnInit() {
  18. }
  19. onRegisterSubmit(){
  20. const user = {
  21. name: this.name,
  22. email: this.email,
  23. username: this.username,
  24. password: this.password
  25. }
  26.  
  27. //for required fields
  28. if(!this.validateService.ValidateRegister(user)){
  29. console.log('fill in all fields');
  30. return false;
  31. }
  32. if(!this.validateService.ValidateEmail(user.email)){
  33. console.log('put correct email');
  34. return false;
  35. }
  36. }
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement