Angular 2 ngfor first, last, index loop

后端 未结 3 2014
耶瑟儿~
耶瑟儿~ 2021-01-30 05:00

I\'m trying to set as default the first occurrence in this example: plunkr

getting the following error:

    Unhandle         


        
3条回答
  •  野的像风
    2021-01-30 05:26

    Check out this plunkr.

    When you're binding to variables, you need to use the brackets. Also, you use the hashtag when you want to get references to elements in your html, not for declaring variables inside of templates like that.

     
    ...
    

    Edit: Thanks to Christopher Moore: Angular exposes the following local variables:

    • index
    • first
    • last
    • even
    • odd

提交回复
热议问题