Good evening,
I have two select option
the first one I have a ng-change
that filters by php the data that will be shown in the second select
what happens and that it filters well by the browser console I can see that it filters well returns the% filtered% does not appear in the select options how can I resolve this?
View
<div ng-controller="FiltraEstabelecimentos">
<form>
<div class="row">
<div class="col">
<label ng-controller="ListaDistritos" style="border-radius: 10px; margin: 0px 0px 10px 0px;" class="item item-input item-select">
<div class="input-label">
Distrito
</div>
<select ng-controller="ListaConcelhos" ng-model="distrito" ng-options="lista_distritos as lista_distritos.titulo for lista_distritos in distritos" ng-change="id_distrito()"></select>
</label>
<label ng-controller="ListaConcelhos" style="border-radius: 10px;" class="item item-input item-select">
<div class="input-label">
Concelho
</div>
<select ng-model="concelho" ng-options="lista_concelhos as lista_concelhos.titulo for lista_concelhos in concelhos"></select>
</label>
</div>
</div>
<div style="margin:0px 10px 0px 10px;">
<button type="submit" ng-click="filtra_estabelecimentos()" style="background-color: #CA5B60; border:#CA5B60; border-radius: 10px;" class="button button-block button-positive">
<i class="ion-search"></i> Pesquisar
</button>
</div>
</form>
</div>
Controllers
.controller('ListaDistritos', function($scope, $http) {
$http.get("https://www.sabeonde.pt/api/api_distritos.php").success(function (data) {
$scope.distritos = data;
});
})
.controller('ListaConcelhos', function($scope, $http, $stateParams) {
$scope.id_distrito= function (){
$http.get("https://www.sabeonde.pt/api/api_concelhos.php?id_distrito="+$scope.distrito.id).success(function (data) {
$scope.$watch('data', function(newValue, oldValue) {
console.log(newValue);
$scope.concelhos = newValue;
});
});
};
})