2

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() {}

    }
Akin Dönmez
  • 353
  • 8
  • 24

1 Answers1

3

ngValue was added in beta.14. If you're using an older version this error is to be expected.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567