0
I have the following code:
$http.get('/estados').success(function(retorno) {
$scope.ufs = retorno.ufs;
console.log(retorno);
});
and the outcome of console.log(retorno)
is:
Now I’m trying to show the values of this return in a <select>
of HTML:
<section class="input-field col l1 s12">
<i class="material-icons prefix">public</i>
<select name="uf" required="true">
<option ng-repeat="(key, value) in ufs">[{value.sigla}]</option>
</select>
</section>
However it is not showing any value, but when inspecting the element I see the code below:
He’s assigning the values to <option>
of <select>
but on the page for the client to select nothing appears.
Someone’s already been through it?
NOTE: I am used {[
because I switched the configs.
app.config(function($interpolateProvider) {
$interpolateProvider.startSymbol('[{').endSymbol('}]');
});
When you give it to me:
console.log(retorno.ufs)
what the result?– DiegoAugusto
Try to put ng-repeat in select
– DiegoAugusto
@Techies the result of
console.log(retorno.ufs) é igual, so muda que na primeira linha fica
[Object, Object....]`– MeuChapeu
Tried to put ng-repeat in select? @Meuchapeu
– DiegoAugusto
does not work in select
– MeuChapeu
@Techies believe the problem is not related to the angular since the options were generated correctly.
– Oeslei
@Oeslei yes, I was imagining the same, just wanted to be 100% sure
– DiegoAugusto
I particularly use ng-options no select: https://docs.angularjs.org/api/ng/directive/ngOptions
– DiegoAugusto