![](/img/trans.png)
[英]Uncaught Error: [$injector:modulerr] Failed to instantiate module showsApp due to: Error: [ng:areq] Argument 'fn' is not a function, got string
[英]Failed to instantiate module ng due to function($provide) is not using explicit annotation
所以这是错误:
Uncaught Error: [$injector:modulerr] Failed to instantiate module ng due to:
Error: [$injector:strictdi] function($provide) is not using explicit annotation and cannot be invoked in strict mode
http://errors.angularjs.org/1.5.8/$injector/strictdi?p0=function(%24provide)
at localhost/build/js/app-vendor.js:53360:12
at Function.annotate [as $$annotate] (localhost/build/js/app-vendor.js:57244:17)
at injectionArgs (localhost/build/js/app-vendor.js:57971:36)
at Object.invoke (localhost/build/js/app-vendor.js:58002:18)
at runInvokeQueue (localhost/build/js/app-vendor.js:57903:35)
at localhost/build/js/app-vendor.js:57912:11
at forEach (localhost/build/js/app-vendor.js:53613:20)
at loadModules (localhost/build/js/app-vendor.js:57893:5)
at createInjector (localhost/build/js/app-vendor.js:57815:19)
at doBootstrap (localhost/build/js/app-vendor.js:55050:20)
http://errors.angularjs.org/1.5.8/$injector/modulerr?p0=ng&p1=Error%3A%20%5….com%3A21293%2FWebGui%2Fbuild%2Fjs%2Fapp-vendor.js%3A55050%3A20)
通常,您知道该怎么做:搜索未注释的函数。 但:
ngAnnotate
运行代码 function($provide)
-是徒劳的 我捕获了抛出的异常,并且在堆栈跟踪中的某个地方有一个:
var injector = createInjector(modules, config.strictDi);
injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector',
function bootstrapApply(scope, element, compile, injector) {
scope.$apply(function() {
element.data('$injector', injector);
compile(element)(scope);
});
}]
);
return injector;
和
if (!($inject = fn.$inject)) {
$inject = [];
if (fn.length) {
if (strictDi) {
if (!isString(name) || !name) {
name = fn.name || anonFn(fn);
}
throw $injectorMinErr('strictdi',
'{0} is not using explicit annotation and cannot be invoked in strict mode', name);
}
argDecl = extractArgs(fn);
forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg) {
arg.replace(FN_ARG, function(all, underscore, name) {
$inject.push(name);
});
});
}
fn.$inject = $inject;
}
从我在监视窗口和堆栈跟踪中看到的情况来看,它正在应用程序中某处发生,其中$injector.invoke
以函数作为参数被调用。 但老实说,我搜索了文件,但找不到任何此类调用。
Angular 1.5.8正在发生这种情况。
我也遇到了这个问题,并发现通过禁用Chrome angularjs调试器“ Batarang”可以解决该问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.