“Restangular"错误:$injector:modulerr模块错误

"Restangular" Error: $injector:modulerr Module Error

本文关键字:错误 injector modulerr 模块 Restangular quot      更新时间:2023-09-26

我尝试在我的应用中使用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){
  /**/
});

这是AuthService:

app.service('AuthService', function($cookies, $http, Restangular) {
/**/
  });

有人能帮我吗?有什么问题吗?

当你将第三方模块注入到你的项目模块中时,你应该发送模块名作为参数…

在你的情况下,你注入的是Restangular,这不是Restangular的模块名,把它改为Restangular,你应该没问题…