Kindzoku Kindzoku - 2 years ago 85
AngularJS Question

Restangular - get root collection

I'm trying to implement Restangular in my SPA application.
I have multiple API root addresses.

So I created base providers (factories) for each API root, for example:

function ApiUsers(Restangular){
return Restangular.withConfig(function(config) {

Where /srv/users returns all users.
So my question is - how i can query root? I mean, I want to do something like:

return ApiUsers.getList();


return ApiUsers.all().getList();

But nothing seems to work... :(

Thx in advance :)

Answer Source

Your app.config.js:

'use strict';

var appConfig = function (RestangularProvider) {

  var serverID = ''; // sample 

  // Set default api
  RestangularProvider.setBaseUrl(serverID + '/srv/users');


appConfig.$inject = [


return Restangular.all('').getList();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download