2016-05-23 38 views
2

我做錯了什麼?我得到」EXCEPTION:模板解析錯誤:無法綁定到'ngValue',因爲它不是知原生屬性」無法綁定到'ngValue',因爲它不是已知的本地屬性「

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

    } 

回答

3

ngValue在beta.14加入。如果您使用的是舊版本的這個錯誤是可以預期的。

+3

我使用RC3和它的工作不適合我 – Gab

相關問題