oktatas:web:angular:angular_reaktiv_urlapok_csoportositassal
Különbségek
A kiválasztott változat és az aktuális verzió közötti különbségek a következők.
Előző változat mindkét oldalonElőző változat | |||
oktatas:web:angular:angular_reaktiv_urlapok_csoportositassal [2025/09/26 20:44] – [Teljes kód] admin | oktatas:web:angular:angular_reaktiv_urlapok_csoportositassal [2025/09/26 20:48] (aktuális) – [Érvényesség ellenőrzése] admin | ||
---|---|---|---|
Sor 171: | Sor 171: | ||
<code javascript> | <code javascript> | ||
+ | import { Component } from ' | ||
+ | import { | ||
+ | FormControl, | ||
+ | FormGroup, | ||
+ | ReactiveFormsModule, | ||
+ | Validators | ||
+ | } from ' | ||
+ | |||
+ | @Component({ | ||
+ | selector: ' | ||
+ | standalone: true, | ||
+ | imports: [ReactiveFormsModule], | ||
+ | templateUrl: | ||
+ | styleUrl: ' | ||
+ | }) | ||
+ | export class EmployeeComponent { | ||
+ | |||
+ | employeeForm!: | ||
+ | |||
+ | constructor() {} | ||
+ | ngOnInit() { | ||
+ | this.employeeForm = new FormGroup({ | ||
+ | name: new FormControl('', | ||
+ | city: new FormControl('', | ||
+ | salary: new FormControl(0, | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | onSubmit() { | ||
+ | if (this.employeeForm.valid) { | ||
+ | console.log(' | ||
+ | name: this.employeeForm.value.name, | ||
+ | city: this.employeeForm.value.city, | ||
+ | salary: this.employeeForm.value.salary | ||
+ | }); | ||
+ | } else { | ||
+ | console.log(' | ||
+ | } | ||
+ | } | ||
+ | } | ||
</ | </ | ||
oktatas/web/angular/angular_reaktiv_urlapok_csoportositassal.1758912265.txt.gz · Utolsó módosítás: 2025/09/26 20:44 szerkesztette: admin