I am currently experiencing some difficulties while trying to use *ngFor to access an array of objects in Angular 2. When I define the array like this:
employees=[
{name:'a',age:'25'},
{name:'b',age:'35'}
];
In my HTML template file, I have implemented *ngFor statements as follows:
<ul>
<li *ngFor="let employee of employees ; let i = index;">
{{name}}
</li>
</ul>
However, upon checking the browser console, it is showing errors similar to the following (sample plunker available at http://plnkr.co/edit/0cBHaDM1mHvMf38NtQ7X?p=preview):
Error: Uncaught (in promise): Error: Error in :0:0 caused by: Array[2] is not a constructor TypeError: Array[2] is not a constructor at new AppComponent () at new Wrapper_AppComponent
As a newcomer to Angular 2, any guidance or support on resolving this issue would be highly appreciated.