AngularJS minError未捕获的对象 [英] AngularJS minError Uncaught Object
问题描述
我有一个新的项目AngularJS我刚刚成立。我已经安装了角
和角资源
通过亭子
和所有的好。我已经安装了我以前用过的其他服务 - https://github.com/Fundoo -Solutions / angularjs模态服务的,但是当我注入模块会引起以下错误:
I have a new AngularJS project I've just set up. I've installed angular
and angular-resource
via bower
and all's good. I've installed another service I've used before - https://github.com/Fundoo-Solutions/angularjs-modal-service but when I inject the module it causes the error below:
未捕获的对象
它指向此功能的AngularJS return语句:
It's pointing to the return statement of this function in AngularJS:
function minErr(module) {
return function () {
var code = arguments[0],
prefix = '[' + (module ? module + ':' : '') + code + '] ',
template = arguments[1],
templateArgs = arguments,
stringify = function (obj) {
if (typeof obj === 'function') {
return obj.toString().replace(/ \{[\s\S]*$/, '');
} else if (typeof obj === 'undefined') {
return 'undefined';
} else if (typeof obj !== 'string') {
return JSON.stringify(obj);
}
return obj;
},
message, i;
message = prefix + template.replace(/\{\d+\}/g, function (match) {
var index = +match.slice(1, -1), arg;
if (index + 2 < templateArgs.length) {
arg = templateArgs[index + 2];
if (typeof arg === 'function') {
return arg.toString().replace(/ ?\{[\s\S]*$/, '');
} else if (typeof arg === 'undefined') {
return 'undefined';
} else if (typeof arg !== 'string') {
return toJson(arg);
}
return arg;
}
return match;
});
message = message + '\nhttp://errors.angularjs.org/1.2.18/' +
(module ? module + '/' : '') + code;
for (i = 2; i < arguments.length; i++) {
message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' +
encodeURIComponent(stringify(arguments[i]));
}
return new Error(message);
};
}
我认为这是说,错误
不存在?
我缺少一个模块或东西吗?
Am I missing a module or something?
推荐答案
一,为什么一个人得到这个错误有角的原因..
您所包含的模块不能正常注入也就是说,您必须使用之前正确注入它作为一个依赖注入。所以,请确保它的完成
One of the reason why a person get this error with angular.. The module that you have included is not injected properly i.e. you must inject it as a Dependency injection properly before using that. So, please make sure that it's done
和
另外一个原因是正确定义NG-应用=,并确保该文件,在其中你写你的角度应用code即 angular.module('&LT; APP-名称&gt; ',[])
是作为脚本文件。
Other reason is properly define ng-app="" and make sure that the file in which you have written your angular app code i.e. angular.module('<app-name>', [])
is included as the script file.
希望这有助于!
这篇关于AngularJS minError未捕获的对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!