Reputation: 363
What am i doing wrong ? i get "EXCEPTION: Template parse errors:Can't bind to 'ngValue' since it isn't a known native property"
import {Component, Optional, Inject} from 'angular2/core';
@Component({
selector: 'm-Cities',
template: `
<select [(ngModel)]="selectedCity" style="margin-left: 30px; width:120px; height: 50px; padding-left: 50px;">
<option *ngFor="#city of cities" [ngValue]="city">{{city.name}}</option>
</select>
`,
providers: [],
directives: [],
pipes: []
})
export class Mcities{
selectedCity: Object;
cities: Object[] = [
{name: "SF"},
{name: "NYC"}
];
constructor() {}
}
Upvotes: 2
Views: 4336
Reputation: 657446
ngValue
was added in beta.14. If you're using an older version this error is to be expected.
Upvotes: 3