轨道3 + angularjs +微小不生产工作:未知提供商:eProvider [英] Rails 3 + angularjs + minification does not work in production: Unknown provider: eProvider

查看:188
本文介绍了轨道3 + angularjs +微小不生产工作:未知提供商:eProvider的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经照着所有我能找到固定微小的,例如。

I've followed all the instructions I can find for fixing minification, e.g.

var MyController = function(renamed$scope, renamedGreeter) {
...
}
MyController.$inject = ['$scope', 'greeter'];

someModule.factory('greeter', ['$window', function(renamed$window) {
...;
}]);

但角度拒绝仍然有效。它总是引发错误未知提供商:eProvider

yet angular refuses to work still. It always throws the error "Unknown provider: eProvider"

下面是我的两个企图得到它的工作...任何人都可以帮忙吗?

Here are my two attempts to get it working... can anyone help?

https://github.com/jemminger/angular-test1

https://github.com/jemminger/angular-test2

他们已经有了资产precompiled和发展模式配置为生产工作,所以你应该只能够轨道的看到它(不)的工作。

They've already had the assets precompiled and development mode is configured to work as production, so you should just be able to "rails s" to see it (not) work.

推荐答案

找到了!他们从来没有说要注射修复应用到服务太...解决的办法是改变这样的:

Found it! They never said to apply the injection fixes to services too... The solution is to change this:

angular.module('itemServices', ['ngResource']).
    factory('Item', function($resource){
      return $resource('items/:item_id.json', {}, {
        query: {method:'GET', params:{ item_id: 'all' }, isArray:true}
      });
    });

这样:

angular.module('itemServices', ['ngResource']).
    factory('Item', ['$resource', function($resource){
      return $resource('items/:item_id.json', {}, {
        query: {method:'GET', params:{ item_id: 'all' }, isArray:true}
      });
    }]);

这篇关于轨道3 + angularjs +微小不生产工作:未知提供商:eProvider的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆