나는 angular2에 익숙하지 않고 어떻게 angular2를 사용하여 비동기식으로 드롭 다운을 바인드하는지 궁금합니다. 나는이observables를 사용하여 angular2에서 드롭 다운을 비동기 적으로 바인드하는 방법은 무엇입니까?
this.http.get('http://172.17.40.41:8089/api/Master/GetAllCountry')
.subscribe(value => {
var results = JSON.parse(value['_body']);
for (let d of results) {
this.countries.push(new Country(d['Country'], d['CountryCode']))
}
}, error => error,() => {
console.log('complete');
return this.countries;
});
같은 서비스를하고 난 드롭 다운의 데이터를 결합하려고 할 때 내가 지금이
this.countries = this.countryServices.getCountry();
같은 구성 요소에서 서비스를 호출하고, 내가 할 수 없습니다입니다 바인딩하기
<select class="form-control input-sm" formControlName="country">
<option class="small" *ngFor="let c of countries" value="{{c.countryCode}}">{{c.countryName}}</option>
</select>
나는 (keyup) = "0"처럼 angular2의 keyup 이벤트를 사용하려고했지만 결코 작동하지 않았습니다.