Reputation: 885
I have added 2 select boxes in my page like below
<div layout>
<md-input-container>
<label>Gender</label>
<md-select ng-model="selectedUser">
<md-option ng-value="user" ng-repeat="user in users">{{ user.sex }}</md-option>
</md-select>
</md-input-container>
</div>
<div layout>
<md-input-container>
<label>Location</label>
<md-select ng-model="selectedLocation">
<md-option ng-value="location" ng-repeat="loca in locations">{{ loca.location }}</md-option>
</md-select>
</md-input-container>
</div>
And js is like this
angular
.module('selectionApp', ['ngMaterial'])
.controller('sliderCtrl', sliderCtrl);
function sliderCtrl ($scope) {
$scope.users = [
{ id: 1, sex: 'Male' },
{ id: 2, sex: 'Female' }
];
$scope.locations = [
{ id: 1, location: 'A' },
{ id: 2, location: 'B' },
{ id: 3, location: 'C' }
];
}
This load Gender select box correctly and second select box load the options but i can't select the specific option. Every time i reload it select the option "C". I want to know how to fix this.
Any help highly appreciate. Thank you,
Upvotes: 1
Views: 104
Reputation: 373
Change ng-value="location" to ng-value="loca"
Your problem may be solve...
best of luck..
Upvotes: 2