Store in GIT
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import {Component, Input, OnInit} from '@angular/core';
|
||||
import {User} from "../../../classes/user.class";
|
||||
import {DataService} from './../../../services/data.service';
|
||||
import {NgForm} from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'edit-user-form',
|
||||
templateUrl: './edit-user-form.component.html'
|
||||
})
|
||||
|
||||
export class EditUserFormComponent implements OnInit {
|
||||
|
||||
@Input()model:User;
|
||||
|
||||
user:User;
|
||||
|
||||
constructor(private data: DataService) {
|
||||
}
|
||||
|
||||
temp: string;
|
||||
|
||||
roles = ['Pilot', 'Student', 'Instructor'];
|
||||
|
||||
submitted = false;
|
||||
|
||||
ngOnInit()
|
||||
{
|
||||
this.user = new User(this.model.id, this.model.name, this.model.card, this.model.role);
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
|
||||
this.model.name = this.user.name;
|
||||
this.model.role = this.user.role;
|
||||
|
||||
this.submitted = true;
|
||||
this.data.load().then(() => {
|
||||
this.data.editUser(this.model).subscribe(b => this.temp = JSON.stringify(b));
|
||||
console.log(this.temp);
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user