Files
gilze-angular/app/pages/planes/form/plane-form.component.ts
T
2026-06-17 16:11:25 +02:00

31 lines
695 B
TypeScript

import {Component} from '@angular/core';
import {Plane} from "../../../classes/plane.class";
import {DataService} from './../../../services/data.service';
@Component({
selector: 'plane-form',
templateUrl: './plane-form.component.html'
})
export class PlaneFormComponent {
constructor(private data: DataService) {
this.plane = new Plane(0, "", "", "", "");
}
temp: string;
public roles = ['Pilot', 'Student', 'Instructor'];
public plane:Plane;
submitted = false;
onSubmit() {
this.submitted = true;
this.data.load().then(() => {
this.data.postPlane(this.plane).subscribe(b => this.temp = JSON.stringify(b));
})
}
}