So, I have this code Fiddle
<div ng-app="testApp">
<div ng-controller="MainCtrl">
<form>
<p>
<select ng-model="selectedItem" ng-options="i.name for i in items"></select>
</p>
<p ng-show="selectedItem.subItems">
<select ng-model="selectedSubItem" ng-options="i.name for i in selectedItem.subItems"></select>
</p>
<p ng-show="selectedSubItem.subItems">
<select ng-model="selectedSubSubItem" ng-options="i.name for i in selectedSubItem.subItems"></select>
</p>
<input type="hidden" name="selection" value="????">
<input type="submit" value="submit">
</form>
</div>
And in that code I only show the next dropdown if the selected item has a child array. Now, I want to populate the value of the hidden field with the last selected value of that dropdown chain using Angular.js.
In another word, if the user chooses an option in the last dropdown that appear, I want that hidden field at the end to have that value to be submitted with the form.
How can I do that?