Here I am creating dropdown and setting default value.And this is my object
$scope.currentprop={
name : "graphFillDirection",
members : [{
name : "ttb",
caption : "Top to Bottom",
}, {
name : "btt",
caption : "Bottom to Top"
}, {
name : "ltr",
caption : "Left to Right"
},{
name : "rtl",
caption : "Right to Left"
}
],
value : "ttb",
//suppose it is : value:""
}
In this object i have members array and property value. So checking with iteraing members.name and value property and this is my html.
<select ng-model="currentprop.value" ng-options="value.name as value.name for (key,value) in currentprop.members" ng-selected="{{currentprop.value == value.name}}"></select>
if the case currentprop.value == value.name matches then i set the value to ng-model. My question is if currentprop.value to be like value:"" then the iterated value never get matched with currentprop.value. so what i need is if value:"" then i set the members[0].name to the ng-model. some please help me. plnkr here