1 | import { Component, OnInit } from '@angular/core';
|
---|
2 | import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
---|
3 | import { DynamicDialogRef } from 'primeng/dynamicdialog';
|
---|
4 | import { UserDto } from 'src/app/_models/dto/userDto';
|
---|
5 |
|
---|
6 | @Component({
|
---|
7 | selector: 'app-register',
|
---|
8 | templateUrl: './register.component.html',
|
---|
9 | styleUrls: ['./register.component.css']
|
---|
10 | })
|
---|
11 | export class RegisterComponent implements OnInit {
|
---|
12 |
|
---|
13 | user: UserDto;
|
---|
14 | myForm: FormGroup;
|
---|
15 |
|
---|
16 | constructor(private ref: DynamicDialogRef, private fb: FormBuilder) {
|
---|
17 | this.user = new UserDto();
|
---|
18 | this.myForm = fb.group({
|
---|
19 | title: fb.control('initial value', Validators.required)
|
---|
20 | });
|
---|
21 | }
|
---|
22 |
|
---|
23 | ngOnInit(): void {
|
---|
24 | this.myForm = this.fb.group({
|
---|
25 | fullName: this.fb.control('', Validators.required),
|
---|
26 | username: this.fb.control('', Validators.required),
|
---|
27 | password: this.fb.control('', Validators.required),
|
---|
28 | confirmPassword: this.fb.control('', Validators.required)
|
---|
29 | });
|
---|
30 | }
|
---|
31 |
|
---|
32 | onFormSubmitSignUp(user) {
|
---|
33 | this.ref.close(user);
|
---|
34 | //window.location.reload();
|
---|
35 |
|
---|
36 | }
|
---|
37 |
|
---|
38 | }
|
---|