angularjs - 将 VividCortex angular-recaptcha 依赖项添加到 AngularJS 模块时出错
问题描述
我正在尝试将 Google reCaptcha v2 添加到我的 AngularJS 应用程序中。我正在尝试使用 VividCortex 的 angular-recaptcha,但我无法将依赖项添加到我的应用程序模块中。
我的模块的原始代码是这样的:
angular.module("myApp")
.config(['$httpProvider','jwtInterceptorProvider', function Config($httpProvider, jwtInterceptorProvider) {
//do stuff
}])
.config([ '$routeProvider', '$httpProvider', function($routeProvider, $httpProvider) {
//do other stuff
}])
.factory('httpRequestInterceptor', ['API_KEY', function(API_KEY) {
//do more stuff
}]);
我一直在尝试添加依赖项,就像它在文档中一样:
angular.module("myApp", ['vcRecaptcha'])
但它给了我这个错误:
未捕获的错误:[$injector:modulerr] 无法实例化模块 myApp 由于:错误:[$injector:unpr] 未知的提供者:jwtInterceptorProvider
如果我不尝试添加依赖项,我不会收到此错误。
提前致谢!
解决方案
问题解决了。我对 AngularJS 缺乏了解,这让我认为这是创建模块的地方,但它只是被检索,所以当我添加依赖项时,我再次创建它而没有 jwtInterceptor 依赖项,因此出现错误消息。我找到了创建模块的位置,添加了依赖项,现在它可以工作了。
推荐阅读
- r - R中是否有理由无法对值之间有空格的变量进行操作?
- c++ - 如何转换自动(用于矢量
) 从 c++11 到 c++98? - linux - aria2c 不输出结果表
- javascript - 为什么 React 需要连接到服务器?
- nlp - 如何查找与命名实体相关的所有维基百科页面?
- android - 如何从 BroadcastReceiver 类中的 Roomdatabase 访问数据
- python - try 块没有被执行
- c# - C#派生类初始化
- pine-script - 如何将我的 pinescript v2 转换为 pinescript v4?
- r - 如何折叠键 id 上的行但将唯一测量值保留在新变量中?