Évolution des formulaires d'ajout

This commit is contained in:
Sébastien André
2019-12-03 16:44:44 +01:00
parent b1613ab15b
commit 0373a2d5af
13 changed files with 138 additions and 9 deletions

View File

@@ -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();
}
}