Mengatur nilai default dalam daftar drop -down di angularjs
EmployeeStatusChangeRoutingInput: {
Action: 'value3'
}
ng-options="option.Name as option.Value for option in Data.Actions"
angular.module('myApp', [])
.controller('myCtrl', ['$scope', function($scope) {
$scope.Data = {
Actions: [{
Value: 'test1',
Name: 'value1'
}, {
Value: 'test2',
Name: 'value2'
}, {
Value: 'test3',
Name: 'value3'
}],
EmployeeStatusChangeRoutingInput: {
Action: 'value3'
}
}
}])
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.5/angular.min.js"></script>
<div ng-app="myApp" ng-controller="myCtrl">
<div class="dropdownIcon">
<select name="actions" id="actions" ng-options="option.Name as option.Value for option in Data.Actions" ng-focus="ActionsLabel = true" ng-blur="ActionsLabel = false;" ng-model="Data.EmployeeStatusChangeRoutingInput.Action"></select>
</div>
</div>
SAMER SAEID