0
I have already opened a question of this here and a user of the site helped me, and cleared my doubts. However, when trying to use the code again that he presented me, the same is presenting errors. He presented me the code with States, and I modified it to Neighborhoods (clean code because the information will be put yet.)
The code is as follows::
<script>
(function() {
'use strict';
angular
.module('appBairros', []);
angular
.module('appBairros')
.controller('BairroController', BairroController);
BairroController.$inject = [];
function BairroController() {
var bairro = this;
bairro.opcoes = [];
iniciar();
function iniciar() {
bairro.opcoes = [];
bairro.opcoes.push({nome: "Botafogo", informacoes: "Botafogo é um bairro que começa com B"});
bairro.opcoes.push({nome: "Madureira", informacoes: "Madureira é um bairro que começa com M"});
bairro.seleciona = bairro.opcoes[0];
}
}
})();
<div ng-app="appBairros">
<div ng-controller="BairroController as bairro">
<label class="bairros">Selecione o Bairro para exibir as informações que deseja.</label>
<select ng-options="opcao.nome for opcao in bairro.opcoes" ng-model="bairo.selecionado"></select>
<br>
<br>
{{bairro.selecionado.informacoes}}
And when I run my code, it presents that way:
I made this correction and has not changed in the execution. It continues running without presenting the options.
– Inez Boldrin
check your typing, in your model, Voce is using bairo with 1 R .. and should use neighborhood with 2 R
– andrepaulo