Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
Please check the Versions section.
Please run
ng --version. If there's nothing outputted, please run in a Terminal:node --versionand paste the result here:
angular-cli: 1.0.0-beta.24
node: 7.3.0
os: linux x64
@angular/common: 2.4.1
@angular/compiler: 2.4.1
@angular/core: 2.4.1
@angular/forms: 2.4.1
@angular/http: 2.4.1
@angular/platform-browser: 2.4.1
@angular/platform-browser-dynamic: 2.4.1
@angular/router: 3.4.1
@angular/compiler-cli: 2.4.1
Was this an app that wasn't created using the CLI? What change did you do on your code? etc.
- create a new project with ng new angular-test
- modify app.component.ts like this:
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
title = 'app works!';
products: Array
ngOnInit() {
this.products = [];
let product = new Product();
product.id = 1;
product.name = 'Car';
this.products.push(product);
}
}
class Product {
id: number;
name: string;
}
Add this to app.component.html:
"): AppComponent@2:5
Property binding ngForIn not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations". ("
[ERROR ->]
Do I miss anything?
Can you show me /app.component.html?
This Markdown styling confuses me.
app.component.html looks like this:
<div *ngFor='let p in products'>{{p.id}} {{p.name}}</div>
Oops, the ngFor syntax is "let p of products" not "let p in products". My bad.
I wish they had not changed the syntax of in to of in Angular 2. Was it really necessary to force every single Angular user to make the above mistake.
Sorry, I have a hang over this morning. 馃嵒
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
Oops, the ngFor syntax is "let p of products" not "let p in products". My bad.