index angular2

What Is the Difference Between [ngFor] and [ngForOf] in Angular 2?

Angular 2 - ngFor vs. ngForOf

1.     The [ngFor] is not a type safe
2.     The [NgForOf] is a type Safe
3.     The [NgFor] directive instantiates a template once per item from iterate
4.     The [ngFor] and [ngForOf] are actually the selectors of the [NgForOf] directive and it is not two distinct things
5.     The [ngFor] will be works like as collections
6.     The [ngForOf] will be works like as generics

Stayed Informed - Angular 2 Q/A

Example - ngFor

<div *ngFor="let user of users" let i=index;>{{i}} - {{user.name}}</div>

OR

<template>
     <div [ngFor]="let user of users" let i=index;>{{i}} - {{user.name}}</div>
</template>

Example - ngForOf

<div ngFor let-user="$implicit" [ngForOf]="users" let-i="index">{{i}} - {{user.name}} </div>

Introduction of Angular 2 Setup Angular 2 in .NET MVC Advantages of Angular 2
The Major Changes of Angular 2 Component Lifecycle Hooks Support of Modern Browsers
Angular 2 Vs. Angular 1 Angular 4 Vs. Angular 2 Constructors Vs. OnInit
Use of ngInit and ngOnInit ngOnInit() Vs. Constructors HTTP Cookies
Dependency Injection (DI) Inject() Vs. Injectable() Features and Benefits
Bindings in Angular 2Initialize an Array in Angular 2

I hope you are enjoying with this post! Please share with you friends. Thank you!!
ANIL SINGH

Hey! I'm Anil Singh. I author this blog. I'm Active Blogger, Programmer. I love learning new technologies, programming, blogging and participating the forum discussions more...
My Blogs - http://www.code-sample.com and http://www.code-sample.xyz
My Books - Google Amazon and Flipkart Book Store!

You Might Also Like
Post a Comment
www.code-sample.com/. Powered by Blogger.
ASK Questions
SQL Server NodeJs TypeScript JavaScript Angular SQL Server My Book