Im trying to implement a simple callback once an observable has finished, here is my code:
ngOnInit() {
this.propertyService
.getProperties()
.subscribe(
(data: ContentPropertyModel[]) => this.properties = data
);
this.status = 'active';
}
However the status is changed before the observable runs. Any ideas on how i can changes the this.status after the observable runs?
Move this.status
to your subscribe handler:
ngOnInit() {
this.propertyService
.getProperties()
.subscribe(
(data: ContentPropertyModel[]) => {
this.properties = data
this.status = 'active';
}
);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With