javascript – 在rails上使用angularjs和ruby时,未知的提供商电子提供程序错误

前端之家收集整理的这篇文章主要介绍了javascript – 在rails上使用angularjs和ruby时,未知的提供商电子提供程序错误前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个Rails / AngularJS应用程序,在本地开发环境中工作正常.但是,当我将此应用程序部署到Amazon Cloud时,AngularJS会在浏览器控制台中返回此错误
Unknown provider: eProvider <- e

但是它在开发环境中工作正常.

我正在从我的一个javascript文件处理以下服务.例如:

userList. storeActorListWithId()

我的服务如下:

woi.service('userList',['$rootScope','userAPI','recoAPI',function($rootScope,userAPI,recoAPI){

    var actorList = [];
    var actorId = "";
    return{
        storeActorListWithId: function(data){
            actorList = [];
            angular.forEach(data,function(actor){
                if(actor.castname)
                {
                    actorList.push({name: actor.castname,id: actor.castid});
                }
            })
        },getActorListWithId: function(){
            return actorList;
        },storeActorId: function(id){
            actorId = id;
        },getActorId: function(){
            return actorId;
        }
    }

}]);

我的application.js文件如下.它是否安全化?

resolve: {
                checkActorId: function($route,$location,$rootScope){
                    var url = $route.current.params.id;
                    var actorName = url.replace(/\-/g," ").replace(/\~/g,"-").replace(/\$/g,"/");
                    var  actorList = $rootScope.storeActorNameAndId;
                    if($rootScope.storeActorNameAndId){
                        angular.forEach(actorList,function(actor,key){
                            if(actor.name == actorName){
                                $rootScope.actorid = actor.id;
                            }
                        });
                    }
                    else
                    {
                        $location.path("home")
                    }
                }
            }

我已经尝试了许多解决方案(使用DI)在网站上给出,但没有一个帮助我.
请帮帮我..

提前致谢

解决方法

最后得到解决了几个小时的研究….

解决块中存在安全注解问题
下面的代码给出了上面的错误.

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

并通过将以上代码更改为此来解决.

resolve:{
                setParams: ['$rootScope','$route',$route){
                    $rootScope.Programmeid = $route.current.params.programmeid;
                    $rootScope.channelid =   $route.current.params.channelid;
                }];
            }

猜你在找的JavaScript相关文章