How to iterate over a Angular signal object in the html by using @for

Discussão em 'Angular' iniciado por Juergen Gross, Julho 6, 2025.

  1. In the html I have to iterate over a WritableSignal object variableList(), but this html code will not run the loop unless the json string of the variableList() will show correctly in the same html.

    html:

    show JSON of variableList() : {{variableList() | json }}

    @for (variable of variableList(); track [$index]; let i = $i ndex) { <!-- by this loop the UI look will generated by the variableList array -->
    loop test: {{i}}
    }


    And

    variableList = signal<TVariable[]>([]);


    The complete code is on Demo @ stackblitz

    Continue reading...

Compartilhe esta Página