NS-Angular async ListView not working


#1

I’m trying to get a basic ListView to be populated by a BehaviourSubject using the async pipe.

The markup code is very simple :

component.html

<ListView [items]="$photos | async" separatorColor="transparent">
    <ng-template let-item="item">
        <Label>{{ item.upid }}</Label>
    </ng-template>
</ListView>

Next in the component I use the push ChangeDetectionStrategy,subscribe to the service responsible to data retrieval and populate the BehaviourSubject.
Here is the relevant code :

component.ts

user: ComunicationModels.UserDto = {};
  photos: Array<ComunicationModels.PhotoDto> = [];
  $photos: BehaviorSubject<Array<ComunicationModels.PhotoDto>>;

  constructor(...) {
      this.$photos = new BehaviorSubject([]);
      this.user.photos.forEach(
        (idPhoto) => {
          this.postService.getPhoto(idPhoto)
            .subscribe((p) => {
              this.photos.push(p);
              this.$photos.next([...this.photos]);
              // console.dir(this.$photos.value); -> This shows correct information
            });
        });
  }

I don’t get errors, but my listview is completely empty not showing up any items… what am I missing?


#2

@ullal.aaron I think we already discussed this here

Using a behavior subject still works fine on my end. So it must be again something with your binding, we will not be able to help you better until you show us some code where we can reproduce the issue.