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