1

The title says it all, so i will show you the code.

TS

notificationsChannels: Observable<{ name: string }[]>;
ngOnInit() {
      this.notificationsChannels = this._notificationsManagerService
         .getAll(this.endPoint)
         .pipe(
             map(res =>
                 res.body.map(config => {
                    return { name: config['entityName'] };
                 })
              )
         );
}

Template

<p-tabView>
    <p-tabPanel [header]="channel.name | humanizeText" *ngFor="let channel of (notificationsChannels | async)">
    </p-tabPanel>
</p-tabView>

Although the data arrives the template does not reflet it. Maybe im missing something...

4
  • Make sure that getAll method is returning something Commented Nov 28, 2019 at 14:14
  • It does. Im sure!!! Commented Nov 28, 2019 at 14:18
  • I don't think it's the problem but the parentheses are useless around "notificationsChannels | async" Commented Nov 28, 2019 at 14:24
  • i already tried without them too... Commented Nov 28, 2019 at 14:26

2 Answers 2

1

Sometimes these tab components can't handle children being created dynamically. So you could try delaying the creation of everything until the async data is available.

<ng-container *ngIf="notificationsChannels | async as channels">
   <p-tabView>
      <p-tabPanel [header]="channel.name | humanizeText" *ngFor="let channel of channels">
      </p-tabPanel>
   </p-tabView>
</ng-container>
Sign up to request clarification or add additional context in comments.

Comments

0

Try changing your code to this:

<p-tabView>
  <ng-container *ngFor="let channel of notificationsChannels | async">
    <p-tabPanel [header]="channel.name | humanizeText">
    </p-tabPanel>
   </ng-container>
</p-tabView>

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.