Moving to strict.
Create form has now moved to constructor and route data subscribe is type safe.
This commit is contained in:
@ -24,11 +24,16 @@ export class ProfitLossComponent implements OnInit {
|
||||
displayedColumns = ['group', 'name', 'amount', 'total'];
|
||||
|
||||
constructor(private route: ActivatedRoute, private router: Router, private fb: FormBuilder) {
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { info: ProfitLoss }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { info: ProfitLoss };
|
||||
|
||||
this.info = data.info;
|
||||
this.form.setValue({
|
||||
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(),
|
||||
@ -48,13 +53,6 @@ export class ProfitLossComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
});
|
||||
}
|
||||
|
||||
prepareSubmit(): ProfitLoss {
|
||||
const formModel = this.form.value;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user