aufräumen
This commit is contained in:
48
src/app/features/components/auth/login/login.component.ts
Normal file
48
src/app/features/components/auth/login/login.component.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import {
|
||||
ReactiveFormsModule,
|
||||
FormBuilder,
|
||||
Validators,
|
||||
FormGroup,
|
||||
} from '@angular/forms';
|
||||
import { RouterLink } from '@angular/router';
|
||||
|
||||
// Importieren der wiederverwendbaren Komponenten
|
||||
import { ButtonComponent } from '../../../../shared/components/ui/button/button.component';
|
||||
import { FormFieldComponent } from '../../../../shared/components/form/form-field/form-field.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-login',
|
||||
standalone: true,
|
||||
imports: [
|
||||
CommonModule,
|
||||
ReactiveFormsModule,
|
||||
RouterLink,
|
||||
ButtonComponent,
|
||||
FormFieldComponent,
|
||||
],
|
||||
templateUrl: './login.component.html',
|
||||
styleUrl: './login.component.css',
|
||||
})
|
||||
export class LoginComponent {
|
||||
loginForm: FormGroup;
|
||||
|
||||
|
||||
|
||||
constructor(private fb: FormBuilder) {
|
||||
this.loginForm = this.fb.group({
|
||||
email: ['', [Validators.required, Validators.email]],
|
||||
password: ['', [Validators.required]],
|
||||
});
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
if (this.loginForm.valid) {
|
||||
console.log('Formular abgeschickt:', this.loginForm.value);
|
||||
} else {
|
||||
console.log('Formular ist ungültig.');
|
||||
this.loginForm.markAllAsTouched();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user