Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
removeu 24 caracteres do conteúdo
Fonte Link
Jéf Bueno
  • 69,8mil
  • 22
  • 134
  • 244
    <select class="form-control" 
      ng-model="genericCustomersViewModel.customer.addresses[0].stateId"
      ng-options="state.id as state.initials for state in 
      genericCustomersViewModel.allStates track by state.id" 
      ng-change="genericCustomersViewModel.getCityByState(0)" 
      ng-selected="genericCustomersViewModel.customer.addresses[0].stateId">
    </select>`select>
    <select class="form-control" 
      ng-model="genericCustomersViewModel.customer.addresses[0].stateId"
      ng-options="state.id as state.initials for state in 
      genericCustomersViewModel.allStates track by state.id" 
      ng-change="genericCustomersViewModel.getCityByState(0)" 
      ng-selected="genericCustomersViewModel.customer.addresses[0].stateId">
    </select>`
<select class="form-control" 
   ng-model="genericCustomersViewModel.customer.addresses[0].stateId"
   ng-options="state.id as state.initials for state in 
   genericCustomersViewModel.allStates track by state.id" 
   ng-change="genericCustomersViewModel.getCityByState(0)" 
   ng-selected="genericCustomersViewModel.customer.addresses[0].stateId">
</select>

Estou usando a função ng-options e está listando de forma correta, só não está aparecendo o valor marcado como default ( selected ). Segue os trechos do código:
   <select class="form-control" ng-model="genericCustomersViewModel.customer.addresses[0].stateId" ng-options="state.id as state.initials for state in genericCustomersViewModel.allStates track by state.id" ng-change="genericCustomersViewModel.getCityByState(0)" ng-selected="genericCustomersViewModel.customer.addresses[0].stateId"> </select>selected


 

Código:

    <select class="form-control" 
      ng-model="genericCustomersViewModel.customer.addresses[0].stateId"
      ng-options="state.id as state.initials for state in 
      genericCustomersViewModel.allStates track by state.id" 
      ng-change="genericCustomersViewModel.getCityByState(0)" 
      ng-selected="genericCustomersViewModel.customer.addresses[0].stateId">
    </select>`

customerCustomer

Estou usando a função ng-options e está listando de forma correta, só não está aparecendo o valor marcado como default ( selected ). Segue os trechos do código:
 <select class="form-control" ng-model="genericCustomersViewModel.customer.addresses[0].stateId" ng-options="state.id as state.initials for state in genericCustomersViewModel.allStates track by state.id" ng-change="genericCustomersViewModel.getCityByState(0)" ng-selected="genericCustomersViewModel.customer.addresses[0].stateId"> </select>


 

customer

Estou usando a função ng-options e está listando de forma correta, só não está aparecendo o valor marcado como default:  selected

Código:

    <select class="form-control" 
      ng-model="genericCustomersViewModel.customer.addresses[0].stateId"
      ng-options="state.id as state.initials for state in 
      genericCustomersViewModel.allStates track by state.id" 
      ng-change="genericCustomersViewModel.getCityByState(0)" 
      ng-selected="genericCustomersViewModel.customer.addresses[0].stateId">
    </select>`

Customer

Fonte Link

ng-options "selected" não funciona

Estou usando a função ng-options e está listando de forma correta, só não está aparecendo o valor marcado como default ( selected ). Segue os trechos do código:
<select class="form-control" ng-model="genericCustomersViewModel.customer.addresses[0].stateId" ng-options="state.id as state.initials for state in genericCustomersViewModel.allStates track by state.id" ng-change="genericCustomersViewModel.getCityByState(0)" ng-selected="genericCustomersViewModel.customer.addresses[0].stateId"> </select>


AllStates

[{  "id":1,
    "description":"ACRE",
    "initials":"AC",
    "specificCountryCode":12,
    "countryId":30 },
{   "id":2,
    "description":"ALAGOAS",
    "initials":"AL",
    "specificCountryCode":27,
    "countryId":30 },
{   "id":3,
    "description":"AMAPÁ",
    "initials":"AP",
    "specificCountryCode":16,
    "countryId":30}]

customer

{  "rg":null,
   "inscricaoMunicipal":null,
   "inscricaoEstadual":null,
   "cpfCnpj":"13",
   "inscricaoEstadualIndicator":null,
   "phoneNumber2":null,
   "phoneNumber3":null,
   "emailNfe":null,
   "emailBoleto":null,
   "branchesIds":[],
   "id":12,
   "name":"Razão social",
   "companyName":null,
   "mainPhoneNumber":null,
   "mainEmail":null,
   "site":null,
   "entityType":1,
   "isActive":true,
   "isDeleted":false,
   "contacts":[],
   "addresses":[  
      {  "id":1,
         "description":null,
         "addressType":0,
         "postalCode":93700,
         "address1":"Balduino Dreger",
         "address2":"Não tem",
         "number":345,
         "district":"Bela Vista",
         "cityId":null,
         "stateId":20,
         "countryId":null,
         "entityId":12
      },
      {  "id":2,
         "description":"Comercial",
         "addressType":0,
         "postalCode":93700,
         "address1":"Rua dos bobos",
         "address2":"Num tem",
         "number":666,
         "district":"Centro",
         "cityId":4057,
         "stateId":19,
         "countryId":null,
         "entityId":12
      }
   ]
}