I have the following dropdown:
<select>
<option ng-repeat="x in Ruas">{{x.Rua}}</option>
</select>
I need to get the value selected in the dropdown (x.Rua) and set it to an attribute of another scope called: home
I have the following dropdown:
<select>
<option ng-repeat="x in Ruas">{{x.Rua}}</option>
</select>
I need to get the value selected in the dropdown (x.Rua) and set it to an attribute of another scope called: home
Assign the selected value to a scope variable indicating a model property, via ng-model
.
The following example stores the selection in the $scope.casa.rua
property (assuming $scope.casa
is a pre-existing object):
<select ng-model='casa.rua'>
<option ng-repeat="x in Ruas">{{x.Rua}}</option>
</select>