Dismiss
Announcing Stack Overflow Documentation

We started with Q&A. Technical documentation is next, and we need your help.

Whether you're a beginner or an experienced developer, you can contribute.

Sign up and start helping → Learn more about Documentation →

I have problem with setting up angularjs + typescript application with restangular plugin

Steps I have done:

  1. bower install --save restangular (now I have in index.html <script src="bower_components/restangular/dist/restangular.js"></script>)

  2. add restangular to app dependencies

    angular.module('myapp', [ 'ngAnimate', 'ngCookies', 'ngResource', 'ngRoute', 'ngSanitize', 'ngTouch', 'restangular' ])

  3. Install typings for restangular
  4. Now I'm trying to set up restangular: /// <reference path="../../typings/restangular/restangular.d.ts" /> ... angular.module('myapp').config(($restangularProvider:restangular.IProvider) => { $restangularProvider.setBaseUrl("http://localhost:1337/"); });

The problem is that my browser throws error because it cannot resolve $restangularProvider dependency.

What I am doing wrong? I must forgot about something

Thanks

share|improve this question
1  
The error means that it can't find a provider named $restangular. According to the documentation it isn't '$restangularProvider', but 'RestangularProvider' – Daan van Hulst Jan 26 at 14:49

I have figured to fix this issue by adding dependencies directly to config function like this:

.config(['RestangularProvider',
  (RestangularProvider: restangular.IProvider) => {
    RestangularProvider.setBaseUrl("http://localhost:1337/");
  }]);
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.