I have a select box on my webpage that I need to fill with data received from a server. I am currently using a service to fetch this data, but I'm unsure how to access the values returned from the promise and populate the ng-options in the select tag.
Fetching data from the resource:
$scope.categories = Category.all({sorting:"asc"});
Resource configuration:
factory('Category', function ($resource) {
return $resource('api/categories/:id', {}, {
all: {method: "GET", isArray: true, params: {sorting: '@sorting'}},
update: {
method: "PUT",
params: {
id: "@id"
}
}
})
}).