Skip to content

Instantly share code, notes, and snippets.

@chanakaDe
Created December 13, 2018 05:54
Show Gist options
  • Save chanakaDe/082fb1ba34eb2d8b26895f3e6f1b1cdd to your computer and use it in GitHub Desktop.
Save chanakaDe/082fb1ba34eb2d8b26895f3e6f1b1cdd to your computer and use it in GitHub Desktop.
// this is how i call service from controller
sessionService.getAllSessions(100, 0).then(function (data) {
console.log(data);
$scope.allSessions = data.data;
});
// This is the service layer
getAllSessions: function (limit, offset) {
return $http({
method: "GET",
url: host.session_manage + '/session/' + limit + '/' + offset
}).then(function (response) {
return response.data;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment