I have two dependent dropdowns. One shows countries another states. I would like the first one to save just the country id but use the entire object as source for the second dropdown. Here's what I have so far. There could potentially be many of these dropdowns in a same screen so that could complicate things because I would need to duplicate temporary variables(countrySource). Any suggestions?
<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>