dashboard-users works!
+ +login works!
+ + diff --git a/src/app/login/login.ts b/src/app/login/login.ts index c39dbb9..7027c09 100644 --- a/src/app/login/login.ts +++ b/src/app/login/login.ts @@ -1,11 +1,10 @@ import { Component } from '@angular/core'; +import { RouterLink } from '@angular/router'; @Component({ selector: 'app-login', - imports: [], + imports: [RouterLink], templateUrl: './login.html', - styleUrl: './login.css' + styleUrl: './login.css', }) -export class Login { - -} +export class Login {} diff --git a/src/app/register/register.html b/src/app/register/register.html index 6b0ba2e..48507e2 100644 --- a/src/app/register/register.html +++ b/src/app/register/register.html @@ -1 +1,42 @@ -register works!
+ diff --git a/src/app/register/register.ts b/src/app/register/register.ts index b0da4cc..b87d497 100644 --- a/src/app/register/register.ts +++ b/src/app/register/register.ts @@ -1,9 +1,14 @@ import { Component } from '@angular/core'; -import { FormControl, FormGroup, Validators } from '@angular/forms'; +import { + FormControl, + FormGroup, + ReactiveFormsModule, + Validators, +} from '@angular/forms'; @Component({ selector: 'app-register', - imports: [], + imports: [ReactiveFormsModule], templateUrl: './register.html', styleUrl: './register.css', }) @@ -12,17 +17,26 @@ export class Register { ngOnInit() { this.registrationForm = new FormGroup({ - email: new FormControl('', Validators.required), + email: new FormControl('', [Validators.required, Validators.email]), username: new FormControl('', Validators.required), password: new FormControl('', Validators.required), address: new FormGroup({ - street1: new FormControl(''), + street1: new FormControl('', Validators.required), street2: new FormControl(''), - city: new FormControl(''), - state: new FormControl(''), - zip: new FormControl(''), - country: new FormControl(''), + city: new FormControl('', Validators.required), + state: new FormControl('', Validators.required), + zip: new FormControl('', [Validators.required]), + country: new FormControl('', Validators.required), }), }); } + + submit() { + if (!this.registrationForm.valid) { + for (const control in this.registrationForm.controls) { + console.log(this.registrationForm.controls[control].errors); + } + return; + } + } }