Following is my Component:
import { Component } from 'angular2/core';
@Component({
selector: 'test',
template:
`
<ul >
<li *ngFor="let t of test">
<span >{{t}}</span>
</li>
</ul>
`
})
export class TestComponent implements OnInit{
test: string[];
constructor(){
this.test = ["Saab", "Volvo", "BMW"];
}
}
I am getting the following error when I try to load the component:
EXCEPTION: Template parse errors:
Can't bind to 'ngFor' since it isn't a known native property ("<ul >
<li [ERROR ->]*ngFor="let t of test">
<span >{{t}}</span>
</li>
"):
Also, I am not sure whether I should use '@angular/core' or 'angular2/core' while importing Component.
@angular/core
comes from the release candidate and is more recent. Not certain why you'd be seeing this error though. – Goldner@angular/core
if you are using "2.0.0-rc.1" – Nevermore*ng-for
instead. If this works then you have a really old Angular2 version. – Matinee