Select inputs are not selected when I load a form from an object. The values of the select are defined in the controller. How do I load the page and the selects to be selected with the object values?
For example, if the value of the project type is 2, select is selected with option value 2.
HTML:
<select class="form-control" name="tipo" ng-model="vm.projeto.tipo" ng-options="k as v for (k, v) in vm.tipos">
<option value="">Selecione o tipo projeto</option>
</select>
Ctrl:
vm.projeto = {
nome: "Projeto 1",
tipo: 2
};
vm.tipos = {
1: "Tipo 1",
2: "Tipo 2",
3: "Tipo 3"
};
EDIT: In this post: #, the solution was to use a value of type string instead of number, but I did the test and did not work, the curious thing is that it seems to change the option and return to the default very fast.