67 lines
1.3 KiB
TypeScript
67 lines
1.3 KiB
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
import { Router } from '@angular/router';
|
|
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
|
|
|
@Component({
|
|
selector: 'of-member-signup',
|
|
templateUrl: './signup.component.html',
|
|
styleUrls: ['./signup.component.scss']
|
|
})
|
|
export class SignupComponent implements OnInit {
|
|
|
|
signupForm: FormGroup;
|
|
formErrors = {
|
|
'email': '',
|
|
'password': '',
|
|
'pwConfirm': '',
|
|
'name': '',
|
|
'phone': '',
|
|
'company': ''
|
|
};
|
|
|
|
constructor(
|
|
private router: Router,
|
|
private formBuilder: FormBuilder
|
|
) { }
|
|
|
|
ngOnInit() {
|
|
this.initForm();
|
|
}
|
|
|
|
initForm() {
|
|
this.signupForm = this.formBuilder.group({
|
|
'email': ['', [
|
|
Validators.required,
|
|
Validators.email
|
|
]
|
|
],
|
|
'password': ['', [
|
|
Validators.pattern('^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$'),
|
|
Validators.minLength(6),
|
|
Validators.maxLength(25)
|
|
]
|
|
],
|
|
'pwConfirm': ['', [
|
|
Validators.pattern('^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$'),
|
|
Validators.minLength(6),
|
|
Validators.maxLength(25)
|
|
]
|
|
],
|
|
'name': ['', [
|
|
Validators.required
|
|
]
|
|
],
|
|
'phone': ['', [
|
|
Validators.required
|
|
]
|
|
],
|
|
'company': ['', [
|
|
Validators.required
|
|
]
|
|
],
|
|
});
|
|
|
|
}
|
|
|
|
}
|