我有一个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', function($rootScope, $route) { $rootScope.Programmeid = $route.current.params.programmeid; $rootScope.channelid = $route.current.params.channelid; }]; }