我在angularjs中的選擇框中顯示國家和城市,這些工作正常。國家的ng-model在我撥打{{country}}時顯示輸出。但是,城市的ng模型不能稱爲{{city}}的模式名稱。我想將其稱爲{{city}}而不是{{city.city}}。請注意,除了城市的模式外,兩個選擇框都正常工作,無法顯示{{city}}AngularJs - ng-options object.object
否則,我可以在通過ng-repeat選擇國家而不是ng選項時獲得城市結果
<select name="Country" ng-model="country" class="item item-input item-select major" required>
<option value=""> Select a Country </option>
<option ng-repeat="country in countries" value="{{country.iso_code_3}}">{{country.name}}</option>
</select>
<select name="City" ng-model="city" data-ng-options="city.name for city in cities| filter:{CountryCode: country}:true" class="item item-input item-select major" required>
<option value="">-- Select a City --</option>
</select>
謝謝你machan你回答了我問的問題。 –