2017-07-28 5 views

答えて

2

あなたはちょうど私がその行が実際にコードを理解するために私のテストの一部としてドロップ持っていたし、十分に確認してください、私はあなたに感謝:(コードを破ったngModel [(ngModel)]="selectedCity"

@Component({ 
    selector: 'my-app', 
    template: '<p-selectButton [options]="cities" [(ngModel)]="selectedCity"></p-selectButton>' 
}) 
export class AppComponent { 

    selectedCity = 'London'; 

    cities: any[]; 

    ngOnInit() { 

     this.cities = [     
      {label:'London', value:'London'}, 
      {label:'Istanbul', value:'Istanbul'}, 
      {label:'Paris', value:'Paris'} 
     ] 
    } 
} 
+0

の値を初期化する必要があります – reza

関連する問題