Passing ngFor variable to an ngIf template

后端 未结 4 436
清酒与你
清酒与你 2020-12-10 02:41

How do I pass the current variable in an ngFor loop to ngIf, if it is using templates with then/else syntax?

It appears that they pass through fine when used inline,

4条回答
  •  情歌与酒
    2020-12-10 03:04

    All you need is to use [ngTemplateOutletContext] Read More

    Here is the way how you can achieve that :

    All Templates

  • Odd: {{number}}
  • Even: {{number}}
  • WORKING DEMO

提交回复
热议问题