Moving to strict.
Create form has now moved to constructor and route data subscribe is type safe.
This commit is contained in:
@ -38,11 +38,16 @@ export class DaybookComponent implements OnInit {
|
||||
private fb: FormBuilder,
|
||||
private ser: DaybookService,
|
||||
) {
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { info: Daybook }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { info: Daybook };
|
||||
|
||||
this.info = data.info;
|
||||
this.form.setValue({
|
||||
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(),
|
||||
@ -66,13 +71,6 @@ export class DaybookComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
});
|
||||
}
|
||||
|
||||
prepareSubmit(): Daybook {
|
||||
const formModel = this.form.value;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user