Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Component, OnInit } from '@angular/core';
- import { ValidateService } from '../../services/validate.service'
- @Component({
- selector: 'app-register',
- templateUrl: './register.component.html',
- styleUrls: ['./register.component.css']
- })
- export class RegisterComponent implements OnInit {
- name: String;
- username: String;
- email: String;
- password: String;
- constructor(private validateService: ValidateService) { }
- ngOnInit() {
- }
- onRegisterSubmit(){
- const user = {
- name: this.name,
- email: this.email,
- username: this.username,
- password: this.password
- }
- //for required fields
- if(!this.validateService.ValidateRegister(user)){
- console.log('fill in all fields');
- return false;
- }
- if(!this.validateService.ValidateEmail(user.email)){
- console.log('put correct email');
- return false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement