2017-12-13 12:15:19 +01:00
|
|
|
import {Component, OnInit, Input} from '@angular/core';
|
|
|
|
import {FormGroup, FormBuilder, Validators} from "@angular/forms";
|
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'entity-form',
|
|
|
|
templateUrl: './entity-form.component.html',
|
|
|
|
})
|
|
|
|
|
|
|
|
export class EntityFormComponent implements OnInit{
|
|
|
|
|
|
|
|
@Input('group')
|
|
|
|
myForm: FormGroup;
|
|
|
|
|
|
|
|
constructor(private _fb: FormBuilder){}
|
|
|
|
|
|
|
|
ngOnInit(): void {
|
|
|
|
}
|
|
|
|
|
|
|
|
public get form() {
|
|
|
|
return this._fb.group({
|
2018-01-24 16:45:12 +01:00
|
|
|
pid: ['', Validators.required],
|
2017-12-13 12:15:19 +01:00
|
|
|
name : ['', Validators.required],
|
2018-01-24 16:45:12 +01:00
|
|
|
isEnabled: '',
|
2017-12-13 12:15:19 +01:00
|
|
|
_id : ''
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public reset() {
|
|
|
|
this.myForm.patchValue({
|
2018-01-24 16:45:12 +01:00
|
|
|
pid: '',
|
2017-12-13 12:15:19 +01:00
|
|
|
name : '',
|
2018-01-24 16:45:12 +01:00
|
|
|
isEnabled: '',
|
2017-12-13 12:15:19 +01:00
|
|
|
_id : ''
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|