Style des formulaires d'ajout
This commit is contained in:
@@ -1,33 +1,50 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
|
||||
import { ServiceComm } from '../../services/service-comm.service';
|
||||
import { GearService } from '../../services/gear.service';
|
||||
import { AddAction } from '../../models/add-action.enum';
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { FormControl, FormGroup, Validators } from "@angular/forms";
|
||||
|
||||
import { ServiceComm } from "../../services/service-comm.service";
|
||||
import { GearService } from "../../services/gear.service";
|
||||
import { AddAction } from "../../models/add-action.enum";
|
||||
|
||||
@Component({
|
||||
selector: 'app-new-gear',
|
||||
templateUrl: './new-gear.component.html',
|
||||
styleUrls: ['./new-gear.component.css']
|
||||
selector: "app-new-gear",
|
||||
templateUrl: "./new-gear.component.html",
|
||||
styleUrls: ["./new-gear.component.css"]
|
||||
})
|
||||
export class NewGearComponent implements OnInit {
|
||||
public addForm: FormGroup;
|
||||
|
||||
constructor(private serviceComm: ServiceComm, private serviceApi: GearService) {
|
||||
constructor(
|
||||
private serviceComm: ServiceComm,
|
||||
private serviceApi: GearService
|
||||
) {
|
||||
this.addForm = new FormGroup({
|
||||
name: new FormControl('', Validators.required),
|
||||
manufacturer: new FormControl('', Validators.required),
|
||||
minSize: new FormControl('', Validators.required),
|
||||
maxSize: new FormControl('', Validators.required),
|
||||
aad: new FormControl('', Validators.required),
|
||||
mainCanopy: new FormControl('', Validators.required),
|
||||
reserveCanopy: new FormControl('', Validators.required),
|
||||
name: new FormControl("", Validators.required),
|
||||
manufacturer: new FormControl("", Validators.required),
|
||||
minSize: new FormControl("", [
|
||||
Validators.required,
|
||||
Validators.min(60),
|
||||
Validators.max(320)
|
||||
]),
|
||||
maxSize: new FormControl("", [
|
||||
Validators.required,
|
||||
Validators.min(60),
|
||||
Validators.max(320)
|
||||
]),
|
||||
aad: new FormControl("", Validators.required),
|
||||
mainCanopy: new FormControl("", [
|
||||
Validators.required,
|
||||
Validators.min(60),
|
||||
Validators.max(320)
|
||||
]),
|
||||
reserveCanopy: new FormControl("", [
|
||||
Validators.required,
|
||||
Validators.min(60),
|
||||
Validators.max(320)
|
||||
])
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
ngOnInit() {}
|
||||
|
||||
onSubmit(formData) {
|
||||
this.serviceApi.AddGear(
|
||||
@@ -41,7 +58,6 @@ export class NewGearComponent implements OnInit {
|
||||
);
|
||||
|
||||
this.serviceComm.RefreshData(AddAction.Gear);
|
||||
|
||||
this.addForm.reset();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user