I'm trying to access value of selected value of dropdown options. But problem is that i already have ng-repeat as parent div and inside that options in dropdowns are also using ng-repeat. So basically its nested ng-repeat.
So I'm not able to access selected values.
<div ng-controller="csrClrt">
<div ng:repeat="item in items track by $index">
<md-list one class="md-accordion">
<md-input-container>
<label>Face Style:</label>
<md-select ng-model="style">
<md-option ng-value="user.name" ng:repeat="user in styles">{{user.name}}</md-option>
</md-select>
</md-input-container>
</md-list>
</div>
<div>
<input type="button" value="get selected value" ng-click="getvalue()"/>
</div>
<p>
if i ttry out of parent ng repeat
</p>
<md-input-container>
<label>Face Style:</label>
<md-select ng-model="style">
<md-option ng-value="user.name" ng:repeat="user in styles">{{user.name}}</md-option>
</md-select>
</md-input-container>
<div>
<input type="button" value="get selected value" ng-click="getvalue()"/>
</div>
</div>
AngularJS
angular.module('MyApp', ['ngMaterial'])
.controller('csrClrt', function ($scope) {
$scope.items=["0"];
stylesdata=[{name:"a"},{name:"b"},{name:"c"}];
var style=[];
for(var i=0;i<stylesdata.length;i++)
{
style.push({
name:stylesdata[i].name
})
}
$scope.styles=style;
$scope.getvalue=function()
{
alert($scope.style);
}
})