Évolution des formulaires d'ajout
This commit is contained in:
@@ -23,7 +23,7 @@ import { ServiceApiGet } from '../services/service-api-get.service';
|
||||
import { ServiceApiPost } from '../services/service-api-post.service';
|
||||
import { ServiceComm } from '../services/service-comm.service';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import {
|
||||
MatPaginatorModule,
|
||||
MatTableModule,
|
||||
@@ -72,6 +72,7 @@ const appRoutes: Routes = [
|
||||
appRoutes,
|
||||
{ enableTracing: true } // <-- debugging purposes only
|
||||
),
|
||||
ReactiveFormsModule,
|
||||
FormsModule,
|
||||
BrowserModule,
|
||||
BrowserAnimationsModule,
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
label {
|
||||
display: inline-block;
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
input[type="text"] {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
@@ -1 +1,7 @@
|
||||
<p>new-aircraft works!</p>
|
||||
<form [formGroup]="addForm" (ngSubmit)="onSubmit(addForm.value)">
|
||||
<div>
|
||||
<label for="aircraftName">Aircraft name</label>
|
||||
<input id="aircraftName" type="text" formControlName="aircraftName">
|
||||
</div>
|
||||
<button class="button" type="submit">Add</button>
|
||||
</form>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'app-new-aircraft',
|
||||
@@ -6,10 +7,21 @@ import { Component, OnInit } from '@angular/core';
|
||||
styleUrls: ['./new-aircraft.component.css']
|
||||
})
|
||||
export class NewAircraftComponent 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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
label {
|
||||
display: inline-block;
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
input[type="text"] {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
input[type="email"] {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
@@ -1 +1,23 @@
|
||||
<p>new-drop-zone works!</p>
|
||||
<form [formGroup]="addForm" (ngSubmit)="onSubmit(addForm.value)">
|
||||
<div>
|
||||
<label for="dzName">Dropzone name</label>
|
||||
<input id="dzName" type="text" formControlName="dzName">
|
||||
</div>
|
||||
<div>
|
||||
<label for="gps">GPS</label>
|
||||
<input id="gps" type="text" formControlName="gps">
|
||||
</div>
|
||||
<div>
|
||||
<label for="address">Address</label>
|
||||
<textarea id="address" type="text" formControlName="address" placeholder="Address of the DZ">
|
||||
</div>
|
||||
<div>
|
||||
<label for="contactMail">Mail of contact</label>
|
||||
<input id="contactMail" type="email" formControlName="contactMail">
|
||||
</div>
|
||||
<div>
|
||||
<label for="type">DZ or/and tunnel</label>
|
||||
<input id="type" type="text" formControlName="type">
|
||||
</div>
|
||||
<button class="button" type="submit">Add</button>
|
||||
</form>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'app-new-drop-zone',
|
||||
@@ -6,10 +7,25 @@ import { Component, OnInit } from '@angular/core';
|
||||
styleUrls: ['./new-drop-zone.component.css']
|
||||
})
|
||||
export class NewDropZoneComponent implements OnInit {
|
||||
public addForm: FormGroup;
|
||||
|
||||
constructor() { }
|
||||
constructor() {
|
||||
this.addForm = new FormGroup({
|
||||
dzName: new FormControl('', Validators.required),
|
||||
gps: new FormControl('x.x,y.y', Validators.required),
|
||||
address: new FormControl('', Validators.required),
|
||||
contactMail: new FormControl('tot@toto.fr', Validators.required),
|
||||
type: new FormControl('[dz]', Validators.required)
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
onSubmit(formData) {
|
||||
console.log(formData.status);
|
||||
console.warn('New data : ', formData);
|
||||
|
||||
this.addForm.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
label {
|
||||
display: inline-block;
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
input[type="text"] {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
@@ -1 +1,7 @@
|
||||
<p>new-gear works!</p>
|
||||
<form [formGroup]="addForm" (ngSubmit)="onSubmit(addForm.value)">
|
||||
<div>
|
||||
<label for="aircraftName">Aircraft name</label>
|
||||
<input id="aircraftName" type="text" formControlName="aircraftName">
|
||||
</div>
|
||||
<button class="button" type="submit">Add</button>
|
||||
</form>
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
label {
|
||||
display: inline-block;
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
input[type="text"] {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
@@ -1 +1,7 @@
|
||||
<p>new-jump-type works!</p>
|
||||
<form [formGroup]="addForm" (ngSubmit)="onSubmit(addForm.value)">
|
||||
<div>
|
||||
<label for="jumptypeName">Jump type name</label>
|
||||
<input id="jumptypeName" type="text" formControlName="jumptypeName">
|
||||
</div>
|
||||
<button class="button" type="submit">Add</button>
|
||||
</form>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'app-new-jump-type',
|
||||
@@ -6,10 +7,21 @@ import { Component, OnInit } from '@angular/core';
|
||||
styleUrls: ['./new-jump-type.component.css']
|
||||
})
|
||||
export class NewJumpTypeComponent implements OnInit {
|
||||
public addForm: FormGroup;
|
||||
|
||||
constructor() { }
|
||||
constructor() {
|
||||
this.addForm = new FormGroup({
|
||||
jumptypeName: 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