I have two components. The first component contains a form and an update button.
And in the second component there is some information that should just change during the update.
So how can I add this.loadSum()
to onSave()
if they are in different components?
component.ts 1:
onSave() {
this.loading = true;
this._svodService.update(this.dayReport.hour_id, this.form.value).subscribe(
() => {
this._toast.success("Saved.");
this.load();
this.loading = false;
},
error => {
this._toast.error(error.error.message);
this.load();
this.loading = false;
}
)
}
component.ts 2:
loadSum() {
this._svodService.getSinkingYear(this.hour_id).subscribe(sinkingYear => {
this.sinkingYear = sinkingYear
}, error => {
this._toast.error(error.error.message);
})
}