1
Ich kann nicht den Standardwert für Dropdown mit ng-options
, kann ich Standard-Wert als Antwort, aber in Dropdown-Einstellung ist es nicht einstellen.Standardwert ist nicht für die Auswahl mit ng-init
in js
$scope.personalDetails = [
{
'fname':'Muhammed',
'lname':'Shanid',
'email':'[email protected]',
'check' : 'Y',
'checkxDrpn' : [
{ key: 'Y',selectVal: "Yes"},
{ key: 'N',selectVal: "No"}
]
},
{
'fname':'John',
'lname':'Abraham',
'email':'[email protected]',
'check' : 'N',
'checkxDrpn' : [
{ key: 'Y',selectVal: "Yes"},
{ key: 'N',selectVal: "No"}
]
},
{
'fname':'raj',
'lname':'komali',
'email':'[email protected]',
'check' : 'N',
'checkxDrpn' : [
{ key: 'Y',selectVal: "Yes"},
{ key: 'N',selectVal: "No"}
]
},
{
'fname':'Roy',
'lname':'Mathew',
'email':'[email protected]',
'check' : 'N',
'checkxDrpn' : [
{ key: 'Y',selectVal: "Yes"},
{ key: 'N',selectVal: "No"}
]
}];
in html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js"></script>
<table class="table table-striped table-bordered">
<tbody>
<tr ng-repeat="personalDetail in personalDetails">
<td>
<select ng-model="personalDetail.selectedDpn" ng-init="personalDetail.selectedDpn = personalDetail.checkxDrpn[1].key" ng-options="option.selectVal for option in personalDetail.checkxDrpn track by option.key" value="personalDetail.checkxDrpn[1].key"></select>
default value : {{personalDetail.checkxDrpn[1].key}}
</td>
</tr>
</tbody>
</table>
Danke Sajeetharan es funktioniert gut. Danke vielmals.. – raj