I have two selection windows, the second selection flag is updated when the first selection flag is changed.
<label>Region</label>
<select ng-model="region"
ng-change="clear(1)"
ng-options="l.region for l in locations"
></select>
<br />
<label>Country</label>
<select ng-model='country'
ng-change="clear(2)"
ng-options="c.country for c in region.countries"
></select>
My locations is a json object that looks like this:
[
{region: "Europe", countries: [{country: "France"}, {country: "UK"}]},
{region: "Africa", countries: [{country: "Cameroon"}, {country: "Algeria"}]}
]
It all works great.
This starts to get complicated when I want to set the value of the first selection window to Europe, and I want to fire the ng-change event in the second selection field.
Any idea on how to do this?
source
share