I have a service for a client's check_ins and a get function that returns the observable.
constructor(private clientService: ClientService) {
this._check_ins = <BehaviorSubject<any>>new BehaviorSubject([]);
}
get check_ins() {
return this._check_ins
}
updateCheckIns(check_ins) {
this._check_ins.next(check_ins)
}
in my view I subscribe to the check_ins like so:
this.check_in_obs = this.checkInService.check_ins.subscribe(check_ins => {
this.check_ins = check_ins
})
and check_in is the parent for another model, repositioning. When I delete the repositioning, I set it to null and attempt to update the check_in to show the repositioning is null:
this.check_in.repositioning = null
this.checkInService.updateCheckIns(this.check_ins)
This seems to work, and when I print the new value for this.check_ins, it is correct, however the view is not updated. I don't understand why the views value for this.check_ins is not in sync with the real value.
Here's the template code:
<ion-row class="" id="weigh-in-table" style="flex-wrap:nowrap;overflow-x: scroll;margin-left: 200px;margin-top:21px;">
<ion-col
no-padding
style="min-width:300px;"
*ngFor="let check_in of check_ins; let i = index"
>
<weigh
[isDraggable]="dragEnabled"
[check_in]="check_in"
[check_ins] = "check_ins"
[client_id]="client.id"
[current_user]="current_user"
[program_id]="program_id"
[client]="client"
[index]="i"
[token]="current_user.auth_token"
>
</weigh>
</ion-col>
</ion-row>
get check_insmethod isn't returning an observable, which may be preventing yoursubscriptionto it in your component from receiving the current value.