[Angular ] ListView Item Template does not update nested observable


#1

Hi,

I have a listView with a custom Item template.

<!-- ListView Template -->
<ListView class="list-group" [items]="collection$ | async">
    <template let-item="item">
      <item-summary [item]="item"></item-summary>
    </template>
</ListView>

The item template contains an Observable, every tick is logged into the console but nothing is updated into the template.

this.myObject$ = xxx
xxx.subscribe(object => console.log(object))  // Update logged into console
<Label [text]="(myObject$ | async)?.name"></Label>

When I move from a listview to an *ngFor, the observable is properly displayed.
As if the custom template was not properly redraw or something. Any idea?

Regards,
Jeremy


#2

You need to update the subscription with the ngOnChanges for the ChildComponent. Keep in mind that there is a small issue with this, I have it reported here: https://github.com/NativeScript/NativeScript/issues/3978