我尝试使用angular在我的应用中进行授权。 我创建了app.service并注入了“Restangular”。我有这个错误
Error: $injector:modulerr Module Error Failed to instantiate module cadastral due to:
Error: $injector:modulerr Module Error Failed to instantiate module Restangular due to:
Error: $injector:nomod Module Unavailable Module 'Restangular' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
我在html页面中包含了所有文件
script src="/app/app/core/js/angular.js" type="text/javascript"
scrip src="/app/app/core/js/angular-resource.js" type="text/javascript"
script src="/app/app/core/js/angular-route.js" type="text/javascript"
script src="/app/app/core/js/restangular.js" type="text/javascript"
这是我的应用代码
var app = angular.module('cadastral', ["ngRoute","ngResource",'ngCookies',"Restangular"]);
app.controller('authCtrl', function($scope,$http,$routeParams,AuthService,$cookies){
/**/
});
Ant这是AuthService:
app.service('AuthService', function($cookies, $http, Restangular) {
/**/
});
有人能帮助我吗? 什么问题?
答案 0 :(得分:0)
当您将第三方模块注入项目模块时,您应该将模块名称作为参数...
发送在您的情况下,您正在注入 Restangular ,这不是restangular的模块名称,将其更改为 restangular ,您应该没问题......
Restangular是其服务的名称而不是模块...