Can you use spread operator in the template in angular

Discussão em 'Angular' iniciado por YulePale, Dezembro 20, 2024.

  1. YulePale

    YulePale Guest

    Can you use spread operator in the template in angular?

    I have seen this question and answer. The accepted answer says it is impossible to do so:


    It's unlikely that you're going to get this syntax to work in a template (there are many valid typescript constructs that don't work in templates).
    ​

    But then I have seen this answer which suggests it is possible to do so.

    When I try doing it I get an error.


    Unexpected token ., expected identifier, keyword, or string at column 2 in
    ​

    I just want to set the record straight. Can you use spread operator in the template in angular? For example:

    <div> [user]='{...member}'</div>
    <!--where member is an object-->

    Continue reading...

Compartilhe esta Página