What am I doing wrong?
import {bootstrap, Component} from \'angular2/angular2\'
@Component({
selector: \'conf-talks\',
template: `
This Statement used in Angular2 Beta version.....
Hereafter use let instead of #
let keyword is used to declare local variable
You should use let keyword as to declare local variables e.g *ngFor="let talk of talks"
Also don't try to use pure TypeScript in this... I wanted to more correspond to for
usage and use *ngFor="const filter of filters"
and got the ngFor not a known property error. Just replacing const by let is working.
As @alexander-abakumov said for the of
replaced by in
.
Use this
<div *ngFor="let talk of talks>
{{talk.title}}
{{talk.speaker}}
<p>{{talk.description}}
</div>
You need to specify variable to iterate over an array of an object
Another typo leading to the OP's error could be using in
:
<div *ngFor="let talk in talks">
You should use of
instead:
<div *ngFor="let talk of talks">
In my case I made the mistake of copying *ng-for=
from the docs.
https://angular.io/guide/user-input
Correct me if I am wrong. But it seems *ng-for=
has been changed to *ngFor=