JSFiddle - React, Tailwind, and code Playground
by Fernando Leal
HTML
<div ng-app="selectExample">
<div ng-controller="ExampleController">
<select class="form-control" name="accounts" ng-model="vm.deposit.account" ng-options="account.agency for account in vm.accounts" required=""></select>
</div>
</div>
JavaScript
angular.module('selectExample', [])
.controller('ExampleController', ['$scope', function ($scope) {
$scope.vm = {
accounts: [{
agency: 'Agency 1',
account: 'a1'
}, {
agency: 'Agency 2',
account: 'a2'
}, {
agency: 'Agency 3',
account: 'a3'
}]
};
$scope.vm.deposit = {
account: $scope.vm.accounts[1] // o segundo valor do array
};
}]);