Style des formulaires d'ajout
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<form [formGroup]="addForm" (ngSubmit)="onSubmit(addForm.value)">
|
||||
<div>
|
||||
<p class="form-group">
|
||||
<label for="aircraftName">Aircraft name</label>
|
||||
<input id="aircraftName" type="text" formControlName="aircraftName">
|
||||
</div>
|
||||
<input id="aircraftName" type="text" formControlName="aircraftName" class="form-control">
|
||||
</p>
|
||||
<button class="button" type="submit" class="btn btn-primary">Add</button>
|
||||
</form>
|
||||
|
||||
@@ -1,32 +1,33 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { AircraftService } from '../../services/aircraft.service';
|
||||
import { ServiceComm } from '../../services/service-comm.service';
|
||||
import { AddAction } from '../../models/add-action.enum';
|
||||
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { FormControl, FormGroup, Validators } from "@angular/forms";
|
||||
import { AircraftService } from "../../services/aircraft.service";
|
||||
import { ServiceComm } from "../../services/service-comm.service";
|
||||
import { AddAction } from "../../models/add-action.enum";
|
||||
|
||||
@Component({
|
||||
selector: 'app-new-aircraft',
|
||||
templateUrl: './new-aircraft.component.html',
|
||||
styleUrls: ['./new-aircraft.component.css']
|
||||
selector: "app-new-aircraft",
|
||||
templateUrl: "./new-aircraft.component.html",
|
||||
styleUrls: ["./new-aircraft.component.css"]
|
||||
})
|
||||
export class NewAircraftComponent implements OnInit {
|
||||
public addForm: FormGroup;
|
||||
|
||||
constructor(private serviceComm: ServiceComm,
|
||||
private serviceApi: AircraftService) {
|
||||
constructor(
|
||||
private serviceComm: ServiceComm,
|
||||
private serviceApi: AircraftService
|
||||
) {
|
||||
this.addForm = new FormGroup({
|
||||
aircraftName: new FormControl('', Validators.required)
|
||||
aircraftName: new FormControl("", Validators.required)
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
ngOnInit() {}
|
||||
|
||||
onSubmit(formData) {
|
||||
this.serviceApi.AddAircraft(formData.value.aircraftName);
|
||||
this.serviceComm.RefreshData(AddAction.Aircraft);
|
||||
|
||||
this.serviceComm.RefreshData(AddAction.Aircraft);
|
||||
this.addForm.reset();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user