function FooController($scope, fooService) {
$scope.total = 0;
$scope.description = '';
fooService.getAsync().then(function(result) {
if (result) {
$scope.total = result.total;
$scope.description = result.description;
}
});
}
function fooService($http) {
var orderPromise = $http.get('someurl');
this.getAsync = function () {
return orderPromise.then(function(result) {
return result.data;
});
};
}