Store in GIT
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
import {Component, Input, OnInit} from '@angular/core';
|
||||
import {Reader} from "../../../classes/reader.class";
|
||||
import {Plane} from "../../../classes/plane.class";
|
||||
import {DataService} from './../../../services/data.service';
|
||||
import {NgForm} from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'edit-reader-form',
|
||||
templateUrl: './edit-reader-form.component.html'
|
||||
})
|
||||
|
||||
export class EditReaderFormComponent implements OnInit {
|
||||
|
||||
@Input()model:Reader;
|
||||
|
||||
reader:Reader;
|
||||
|
||||
constructor(private data: DataService) {
|
||||
|
||||
this.planes = new Array<Plane>();
|
||||
}
|
||||
|
||||
temp: string;
|
||||
|
||||
submitted = false;
|
||||
|
||||
planes:Array<Plane> = new Array<Plane>();
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
this.reader = new Reader(this.model.id, this.model.reader_id, this.model.plane);
|
||||
|
||||
this.data.load().then(()=> {
|
||||
this.data
|
||||
.planes()
|
||||
.subscribe(response => {
|
||||
|
||||
for(let i = 0; i < response.data.length; i++)
|
||||
{
|
||||
var temp:Plane = Plane.toPlane(response.data[i]);
|
||||
this.planes.push(temp);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
|
||||
this.model.plane = this.reader.plane;
|
||||
|
||||
this.submitted = true;
|
||||
this.data.load().then(() => {
|
||||
this.data.editReader(this.model).subscribe(b => this.temp = JSON.stringify(b));
|
||||
console.log(this.temp);
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user