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)); }) } }