This commit is contained in:
2025-12-19 01:08:09 +01:00
parent 0d33fa55a7
commit cee92030ad
13 changed files with 349 additions and 2 deletions

View File

@@ -0,0 +1,26 @@
import { Component } from '@angular/core';
import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
import { Student } from '../Student';
@Component({
selector: 'app-student-form-reactive',
imports: [ReactiveFormsModule],
templateUrl: './student-form-reactive.html',
styleUrl: './student-form-reactive.css',
})
export class StudentFormReactive {
form: FormGroup = null!;
ngOnInit() {
this.form = new FormGroup({
name: new FormControl<string|null>(null),
matrikelnummer: new FormControl<number|null>(null, [Validators.required, Validators.pattern('\\d+')])
});
}
print() {
const value = this.form.value;
const model = new Student(value.name, value.matrikelnummer);
console.log(model);
}
}