Hello,

I am trying the Restangular service and I want wrap a provider around it (I 
want to keep all backend connection logic in one provider, dont know if it 
is very good idea). Is that possible?

angular.module('app.services', ['restangular'])
    .provider(AppProvider', function(Restangular) {
        var restAngular =
            Restangular.withConfig(function(Configurer) {
                Configurer.setBaseUrl('/api');
            });

        this.$get = function(restAngular) {
            var service = {
                getCities: function() {
                    return restAngular.all('messages');
                }
            };
            return service;
        }
   }]);


angular.module('app.controllers', ['google-maps'])
 .controller('MapController', ['$scope', '$filter', 'AppProvider', 
function($scope, $filter, AppProvider) {
        $scope.cities = AppProvider.getCities();
 });

I get: 
Uncaught Error: [$injector:modulerr] Failed to instantiate module app due 
to: Error: [$injector:modulerr] Failed to instantiate module app.services 
due to: Error: [$injector:unpr] Unknown provider: Restangular 
http://errors.angularjs.org/1.2.16/$in...<omitted>...1) 


-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to