I would name the following api routes
/api/user/:id /api/user/inbox /api/user/blah
Will they all be defined in one angular service? And how would I do that? every tutorial that I looked at has a service in which it immediately returns a resource, and this is usually also for CRUD operations. Most likely, I will call these routes in several controllers, so I think that having it in one service is beneficial. Can someone show an example of how to create a service to call these routes?
I would like to do such operations in other controllers
$scope.inbox = $api.getUserInbox() //function which requests api/user/inbox $scope.user = $api.getUser() //function which requests api/user/:id $scope.blah = $api.getUserBlah() //function which requests api/user/blah
where $ api is the service I would define, and getuserInbox () is the function that makes the HTTP request for / api / user / inbox
source share