Update with NPM
Fix css and function name
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
|
||||
import { ServiceComm } from '../../services/service-comm.service';
|
||||
import { ServiceApiPost } from '../../services/service-api-post.service';
|
||||
import { AddAction } from '../../models/add-action.enum';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-new-gear',
|
||||
templateUrl: './new-gear.component.html',
|
||||
@@ -9,7 +14,7 @@ import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
export class NewGearComponent implements OnInit {
|
||||
public addForm: FormGroup;
|
||||
|
||||
constructor() {
|
||||
constructor(private serviceComm: ServiceComm, private servicePost: ServiceApiPost) {
|
||||
this.addForm = new FormGroup({
|
||||
name: new FormControl('', Validators.required),
|
||||
manufacturer: new FormControl('', Validators.required),
|
||||
@@ -25,8 +30,17 @@ export class NewGearComponent implements OnInit {
|
||||
}
|
||||
|
||||
onSubmit(formData) {
|
||||
console.log(formData.status);
|
||||
console.warn('New data : ', formData);
|
||||
this.servicePost.AddGear(
|
||||
formData.value.name,
|
||||
formData.value.manufacturer,
|
||||
formData.value.minSize,
|
||||
formData.value.maxSize,
|
||||
formData.value.aad,
|
||||
formData.value.mainCanopy,
|
||||
formData.value.reserveCanopy
|
||||
);
|
||||
|
||||
this.serviceComm.RefreshData(AddAction.Gear);
|
||||
|
||||
this.addForm.reset();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user