【发布时间】:2016-02-10 14:56:39
【问题描述】:
我有两个相关的下拉菜单。一个显示国家另一个国家。 我希望第一个只保存国家/地区 ID,但使用整个对象作为源 对于第二个下拉菜单。这是我到目前为止所拥有的。在同一个屏幕中可能有许多这样的下拉菜单,这可能会使事情复杂化,因为我需要复制临时变量(countrySource)。有什么建议吗?
<select name="country" ng-model="countrySource" ng-options="cntr as cntr.label for cntr in countries" ng-change="country=countrySource.id">
</select>
<select name="state" ng-model="state" ng-options="st.id as st.label for st in countrySource.states">
</select>
【问题讨论】:
标签: javascript angularjs