Refresh view after array changes in *ngFor or @for witch pipes

Discussão em 'Angular' iniciado por Kamil Kiełczewski, Outubro 25, 2024.

  1. If I use array in my templete

    <div *ngFor="let project of projectsList | searchBy: ['name']:searchValue; index as i">
    ...


    or

    @for (project of projectsList | searchBy : ['name'] : searchValue; track project; let i = $index; ) {
    <div >
    ...
    }


    witch pipe

    @Pipe({
    name: 'searchBy',
    })
    export class SearchByPipe implements PipeTransform {
    transform<T>(value: T[], columnKeys: string[], term: string): T[] {
    ...
    }
    ...
    }


    Then in typescript code, after some action, I add element to array:

    projectsList.push(newProject)


    Then nothing changes (I not see new element on view). Why and how to fix it?

    Continue reading...

Compartilhe esta Página