Hi!
I have a JSON array and i’m trying to get in a drop down menu
html:
<label class="item item-select " id="nieuweTicket-select2">
<span class="input-label">Klant</span>
<select ng-options="klant.custId for klant in Klanten">
<!--<option ng-model="Klant" ng-repeat="Klant in Klanten" value=""></option> -->
</select>
</label>
Controller:
.controller('nieuwCtrl', function($scope, KlantenService, $q){
$scope.Klanten = [];
var deferred = $q.defer();
deferred.promise.then(function(){
});
KlantenService.getKlanten().then(function(data){
$scope.Klanten = data.data;
console.log(data.data);
deferred.resolve();
}).catch(function(err){
$scope.Klanten = [{"custId":"ERROR"}];
deferred.resolve();
});
$scope.Toevoegen = function() {
var Omschrijving = $scope.Omschrijving;
var Klant = $scope.Klant
})
Service:
.service('KlantenService', function ($http){
this.getKlanten = function()
{
return $http.get('http://192.168.0.110/Ticketing/Klanten.php');
}
})
JSON:
[{"custId":"16"},{"custId":"17"},{"custId":"20"},{"custId":"21"},{"custId":"23"},{"custId":"24"},{"custId":"25"},{"custId":"26"},{"custId":"31"},{"custId":"43"},{"custId":"44"},{"custId":"49"},{"custId":"50"},{"custId":"51"},{"custId":"52"},{"custId":"54"},{"custId":"55"},{"custId":"56"},{"custId":"57"},{"custId":"58"},{"custId":"61"},{"custId":"62"},{"custId":"63"},{"custId":"64"},{"custId":"65"},{"custId":"66"},{"custId":"67"},{"custId":"68"},{"custId":"69"},{"custId":"70"},{"custId":"71"},{"custId":"72"},{"custId":"73"},{"custId":"74"},{"custId":"75"},{"custId":"76"},{"custId":"77"},{"custId":"78"},{"custId":"79"},{"custId":"80"},{"custId":"81"},{"custId":"82"},{"custId":"83"}]
If I use ng-repeat, I do get the custId’s in my dropdown but they have no value.
Any idea on how to solve this?