I have problem in RX js observable, where I am not able to get the desired output from...

Discussão em 'Angular' iniciado por Deepak, Fevereiro 12, 2025.

  1. Deepak

    Deepak Guest

    Below observable does not give the right results

    customerWithProjects$ = combineLatest([this.customers$, this.projects$]).pipe(
    map(([customers, projects]) => {
    return projects.map((project) => {
    const customer = customers.find(c => c.id === project.id);
    return {
    ...project,
    id : project.id,
    Name : project.projectName,
    Cost : project.itemCost,
    custName: customer.first_name

    };
    });
    })
    );



    In my display I do not get customer.first_name

    <h2>Projects with Customer Information </h2>
    <div *ngIf="customerWithProjects$ | async as custprojects">
    <mat-list>
    <mat-list-item *ngFor="let custproject of custprojects ">
    {{ custproject.id }}
    {{ custproject.projectName }}
    {{ custproject.itemCost }}
    {{ custproject.custName }}
    </mat-list-item>
    </mat-list>

    </div>


    I was trying to play with different values , but not getting the combine stream working.

    Continue reading...

Compartilhe esta Página