当我的角度应用程序中出现未被捕获的错误时,控制台消息如下所示:
Error: [$injector:modulerr] http://errors.angularjs.org/1.4.3/$injector/modulerr?p0=app&p1=%5B%24injector%3Aunpr%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.4.3%2F%24injector%2Funpr%3Fp0%3DENVIRONMENT%0AJ%2F%3C%40http%3A%2F%2Flocalhost%3A8600%2Flibs.js%3A11%3A416%0Aeb%2Fr.%24injector%3C%40http%3A%2F%2Flocalhost%3A8600%2Flibs.js%3A45%3A375%0Ad%40http%3A%2F%2Flocalhost%3A8600%2Flibs.js%3A43%3A364%0A%40http%3A%2F%2Flocalhost%3A8600%2Fapp%2Fapp.js%3A42%3A18%0Ae%40http%3A%2F%2Flocalhost%3A8600%2Flibs.js%3A44%3A154%0Ad%40http%3A%2F%2Flocalhost%3A8600%2Flibs.js%3A42%3A320%0Ag%2F%3C%40http%3A%2F%2Flocalhost%3A8600%2Flibs.js%3A42%3A452%0Am%40http%3A%2F%2Flocalhost%3A8600%2Flibs.js%3A12%3A320%0Ag%40http%3A%2F%2Flocalhost%3A8600%2Flibs.js%3A42%3A229%0Aeb%40http%3A%2F%2Flocalhost%3A8600%2Flibs.js%3A45%3A1%0AAc%2Fd%40http%3A%2F%2Flocalhost%3A8600%2Flibs.js%3A24%3A339%0AAc%40http%3A%2F%2Flocalhost%3A8600%2Flibs.js%3A25%3A151%0AZd%40http%3A%2F%2Flocalhost%3A8600%2Flibs.js%3A23%3A464%0A%40http%3A%2F%2Flocalhost%3A8600%2Flibs.js%3A294%3A428%0An.Callbacks%2Fj%40http%3A%2F%2Flocalhost%3A8600%2Flibs.js%3A2%3A26920%0An.Callbacks%2Fk.fireWith%40http%3A%2F%2Flocalhost%3A8600%2Flibs.js%3A2%3A27738%0A.ready%40http%3A%2F%2Flocalhost%3A8600%2Flibs.js%3A2%3A29530%0AI%40http%3A%2F%2Flocalhost%3A8600%2Flibs.js%3A2%3A29721%0AnrWrapper%40http%3A%2F%2Flocalhost%3A8600%2F%23%2Fdashboard%3A15%3A12749%0A
哪个没用,但是如果我url_decode它会更好,就像这样:
http://errors.angularjs.org/1.4.3/$injector/modulerr?p0=app&p1=[$injector:unpr] http://errors.angularjs.org/1.4.3/$injector/unpr?p0=ENVIRONMENT
J/<@http://localhost:8600/libs.js:11:416
eb/r.$injector<@http://localhost:8600/libs.js:45:375
d@http://localhost:8600/libs.js:43:364
@http://localhost:8600/app/app.js:42:18
e@http://localhost:8600/libs.js:44:154
d@http://localhost:8600/libs.js:42:320
g/<@http://localhost:8600/libs.js:42:452
m@http://localhost:8600/libs.js:12:320
g@http://localhost:8600/libs.js:42:229
eb@http://localhost:8600/libs.js:45:1
Ac/d@http://localhost:8600/libs.js:24:339
Ac@http://localhost:8600/libs.js:25:151
Zd@http://localhost:8600/libs.js:23:464
@http://localhost:8600/libs.js:294:428
n.Callbacks/j@http://localhost:8600/libs.js:2:26920
n.Callbacks/k.fireWith@http://localhost:8600/libs.js:2:27738
.ready@http://localhost:8600/libs.js:2:29530
I@http://localhost:8600/libs.js:2:29721
nrWrapper@http://localhost:8600/#/dashboard:15:12749
默认情况下,如何通过这种方式获得角度输出错误?感谢。
答案 0 :(得分:6)
它的网址编码是因为它是一个链接。点击它! :d
它将带您进入解释错误的网页。
如果您转到该页面并查看错误,则会因为x错误而导致错误。然后that error will be a link to,点击它。
现在你已经到了最后一页,错误是你有一个名为ENVIRONMENT的未知提供商。
答案 1 :(得分:3)
You can override exception handler:
angular.module('exceptionOverride', []).factory('$exceptionHandler', function() {
return function(exception, cause) {
exception.message += ' (caused by "' + cause + '")';
throw exception;
};
});