如何创建基于countryName的选择选项下拉列表并从角度js中的两个外部json文件加载状态?

时间:2017-03-14 04:46:48

标签: angularjs json

首先选择国家选项从extranal json文件加载和第二个选择状态选项从另一个json文件加载第一个选择countryName选项我需要在angularJs中显示相关状态第二个选择状态选项。我试过下面的代码。

select max(summa_som * 0.01) income
from t_operation
where to_char(date_operation,'MM') = 11
and to_char(date_operation,'YYYY') = 2015
( select max(summa_som * 0.01) income_for_dec2015 from t_operation
where to_char(date_operation,'MM') = 12
and to_char(date_operation,'YYYY') = 2015 ) 

1 个答案:

答案 0 :(得分:0)

由于状态是对象,每当用户从下拉列表中选择国家/地区时,state1将更新.state1将包含城市的密钥。

 <div><select id="country" style="width:250px;" class="" name="selectFranchise" ng-model="state1">
<option value="">Select</option>
  <option ng-repeat="(key,country) in countries"  value="{{key}}">{{country[0]}}</option>
   </select></div>

<div><select id="state" ng-model="cities"><option value=''>Select</option>
  <option ng-repeat="city in states[state1]" value="{{city}}">{{city}}</option></select></div>

jsfiddle