Angular ngFor lifecycle

前端 未结 2 553
醉酒成梦
醉酒成梦 2021-01-21 22:11

I\'m using *ngFor to iterate some data like this:

{{d}}

Everything is fine

2条回答
  •  [愿得一人]
    2021-01-21 22:53

    This issue has no relation with *ngFor, It's the normal behavior of the expression inside the interpolation ({{ }}). It is called by angular intentionally multiple times to check if the expression has changed. Interpolation is meant for fetching (printing) expressions and not recomended for calling methods. It will fire unnecessarily.

    Issue is with the method inside interploation not *ngFor

提交回复
热议问题