Évolution des formulaires d'ajout
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'app-new-gear',
|
||||
@@ -6,10 +7,21 @@ import { Component, OnInit } from '@angular/core';
|
||||
styleUrls: ['./new-gear.component.css']
|
||||
})
|
||||
export class NewGearComponent implements OnInit {
|
||||
public addForm: FormGroup;
|
||||
|
||||
constructor() { }
|
||||
constructor() {
|
||||
this.addForm = new FormGroup({
|
||||
aircraftName: new FormControl('', Validators.required)
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
onSubmit(formData) {
|
||||
console.log(formData.status);
|
||||
console.warn('New data : ', formData);
|
||||
|
||||
this.addForm.reset();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user