dnet40/modules/uoa-admin-portal/branches/project-cli/src/app/pages/entity/entity-form.component.ts @ 53422
1 |
import {Component, OnInit, Input} from '@angular/core'; |
---|---|
2 |
import {FormGroup, FormBuilder, Validators} from "@angular/forms"; |
3 |
|
4 |
|
5 |
@Component({ |
6 |
selector: 'entity-form', |
7 |
templateUrl: './entity-form.component.html', |
8 |
})
|
9 |
|
10 |
export class EntityFormComponent implements OnInit{ |
11 |
|
12 |
@Input('group') |
13 |
myForm: FormGroup; |
14 |
|
15 |
constructor(private _fb: FormBuilder){} |
16 |
|
17 |
ngOnInit(): void { |
18 |
}
|
19 |
|
20 |
public get form() { |
21 |
return this._fb.group({ |
22 |
pid: ['', Validators.required], |
23 |
name : ['', Validators.required], |
24 |
isEnabled: '', |
25 |
_id : '' |
26 |
});
|
27 |
}
|
28 |
|
29 |
public reset() { |
30 |
this.myForm.patchValue({ |
31 |
pid: '', |
32 |
name : '', |
33 |
isEnabled: '', |
34 |
_id : '' |
35 |
});
|
36 |
}
|
37 |
|
38 |
}
|
- « Previous
- 1
- 2
- 3
- 4
- Next »