前に呼び出され、私はコントローラNG-initをAPIレスポンス
this.getStates = function() {
LoadingService.enableLoading();
CartService.getStates(self.customerDetails.Country).then(function (response) {
response = response.data;
self.states = response.State;
LoadingService.disableLoading();
}).catch(function (response) {
console.log(response);
LoadingService.disableLoading();
});
};
にこのような機能を持っており、私の見解では、それはこのように、ここで
をレンダリングするには、テンプレートコードは
です<select required id='country' class="form-control" ng-model="checkoutCntrl.customerDetails.Country" ng-init="checkoutCntrl.customerDetails.Country = checkoutCntrl.countries[107]"
ng-options="item.CountryCode as item.CountryName for item in checkoutCntrl.countries track by item.CountryCode"
ng-select="checkoutCntrl.getStates()" ng-change="checkoutCntrl.getStates()">
</select>
どのように選択すればデフォルトの国を選択したかったのですか?私は、NG-のinit内の機能を使用するときに呼び出され、我々は、サーバーからデータを取得する前に、ここで
は状態
self.customerDetails.Countryがあるthis.getStates = function() {
console.log('obj=====>');
console.log(self.customerDetails.Country.CountryCode);
LoadingService.enableLoading();
CartService.getStates(self.customerDetails.Country).then(function (response) {
response = response.data;
self.states = response.State;
LoadingService.disableLoading();
}).catch(function (response) {
console.log(response);
LoadingService.disableLoading();
});
};
を取得しようとしている国の値を設定した後、次のコードであり、オブジェクトとして来る
テンプレートコードを表示するのを助けてください。 – WorkWe