Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

I've one array with several objects in JSON, & a select carries an array. Depending on the selection of array, other select box get loaded which is just below it.

Markup

<div class="list">
  <label class="item item-input item-select col col-50">
    <div class="input-label">
      Mês
    </div>
    <select class="select-estado" 
            ng-model="mesSelecionado" 
            ng-options="meses.mes for meses in mes">
      <option value="">Selecione um mês</option>
    </select>
  </label>
</div>



<div class="list">
  <label class="item item-input item-select col col-50">
    <div class="input-label">
      Estado
    </div>
    <select name="estados" class="select-estado" 
            ng-model="estadoSelecionado" 
            ng-options="mesSelecionadoAtual.estados as estados.estado for estados in mesSelecionadoAtual.estados">
      <option value="">Selecione um estado</option>
    </select>
  </label>
</div>

Problem

When I put 2 in select box. the array which is generated ... It always selects the last house of the array: /

Does any one have idea what would be the reason behind it?

Problem Codepen

share|improve this question

closed as off-topic by Matt Burland, Matthew Green, uKolka, rene, bytecode77 May 5 '15 at 21:05

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Matt Burland, Matthew Green, uKolka, rene, bytecode77
If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 0 down vote accepted

You have missed some angular bootstraps ...

angular.module("myApp", []).controller("myCtrl", function($scope){
  ...
})

Look at this codepen :

http://codepen.io/anon/pen/GJpmYv

However, I would suggest you to take a look at the free chapters of angularjs at codeschool:

https://www.codeschool.com/courses/shaping-up-with-angular-js

share|improve this answer
    
thank you, and excuse the level of angularjs – Lucas Padilha May 5 '15 at 19:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.