What is the difference between [ngFor] and [ngForOf] in angular2?

前端 未结 5 423
南笙
南笙 2020-12-05 13:02

As per my understanding, Both are doing the same functions. But,

  • ngFor would be works like as collections?.

  • ngFo

5条回答
  •  死守一世寂寞
    2020-12-05 13:27

    In my opinion what I got from the angular document,

    • [ngFor] is not type safe
    • [NgForOf] is type safe

    Because both class details are little different

    • ngFor Class type is any type

    • But ngForOf class type is generic ngForOf : NgIterable


    ngForOf looks like generics which I have already mentioned in my question.

提交回复
热议问题