2024-11-19 11:32:02 +01:00
|
|
|
import { Component } from '@angular/core';
|
|
|
|
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-test',
|
|
|
|
standalone: true,
|
|
|
|
imports: [ReactiveFormsModule],
|
|
|
|
templateUrl: './test.component.html',
|
2025-01-28 08:27:37 +01:00
|
|
|
styleUrl: './test.component.css',
|
2024-11-19 11:32:02 +01:00
|
|
|
})
|
|
|
|
export class TestComponent {
|
|
|
|
public loginForm!: FormGroup;
|
|
|
|
|
|
|
|
public ngOnInit(): void {
|
|
|
|
this.loginForm = this.setUpLoginForm();
|
|
|
|
|
|
|
|
console.log(this.loginForm);
|
|
|
|
}
|
|
|
|
|
|
|
|
setUpLoginForm(): FormGroup {
|
|
|
|
return new FormGroup({
|
2025-01-28 08:27:37 +01:00
|
|
|
username: new FormControl('Jan'),
|
|
|
|
password: new FormControl(''),
|
2024-11-19 11:32:02 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
reset(): void {
|
|
|
|
this.loginForm = this.setUpLoginForm();
|
|
|
|
}
|
|
|
|
|
|
|
|
submit(): void {
|
|
|
|
console.log(this.loginForm.value);
|
|
|
|
}
|
|
|
|
}
|