Unknown Provider e-provider error while using angularjs and ruby on rails

前端 未结 3 736
滥情空心
滥情空心 2021-01-03 20:45

I have a Rails/AngularJS app which works fine in local development environment. However, when I deployed this app to Amazon Cloud the AngularJS returns this error in the bro

相关标签:
3条回答
  • 2021-01-03 21:23

    in my case

    app.config(function ($stateProvider) {
      $stateProvider
        .state('A', {
          ...,       
        });
    });
    

    was changed to

    app.config(["$stateProvider", function ($stateProvider) {
      $stateProvider
        .state('A', {
          ...,       
        });
    }]);
    

    then minification works

    0 讨论(0)
  • 2021-01-03 21:23

    In my case (Rails app), I had to remove the uglifier gem from my Gemfile and then remove the config line in config/environments/production.rb:

    config.assets.js_compressor = :uglifier
    
    0 讨论(0)
  • 2021-01-03 21:33

    Finally got the solution after hours of research.

    There was problem of minification-safe annotation in resolve block. This code was giving the above error.

    resolve: {
        setParams: function($rootScope, $route) {
            $rootScope.Programmeid = $route.current.params.programmeid;
            $rootScope.channelid = $route.current.params.channelid;
        }
    }
    

    I resolved it by changing the code to this:

    resolve: {
        setParams: ['$rootScope', '$route', function($rootScope, $route) {
            $rootScope.Programmeid = $route.current.params.programmeid;
            $rootScope.channelid = $route.current.params.channelid;
        }];
    }
    
    0 讨论(0)
提交回复
热议问题