0
In my project I have a dropdown, iterated array. Note that in the array I have a key called default which is set to true or false. I wish the dropdown defalt value was what came with the key set to true.
If I do this: $scope.nfe.naturezaOperacao = $scope.cfops[0];, works, however, I am setting static, I would like you to set the default key according to the default key.
JS:
angular.module('nfe', []).controller('nfeController', function ($scope, $http) {
  $scope.nfe = [];
  $scope.cfops = [
    {codigo: "5.102", descricao : "Venda a vista 12%", elo: "012", default: false},
    {codigo: "5.102", descricao : "Venda a vista 17%", elo: "017", default: true}
  ];
  //$scope.nfe.naturezaOperacao = $scope.cfops[0];
});
HTML:
<select
 class="form-control"
 name="NF_NATUREZA_OPERACAO"
 id="NF_NATUREZA_OPERACAO"
 data-ng-model="nfe.naturezaOperacao"
 data-ng-init=""
 data-ng-options="cfop.descricao for cfop in cfops">
</select>