Javascript 可读的Angular.js错误?
默认情况下,Angular.js不提供人类可读的错误消息 是否要将默认的、神秘的Angular.js异常URL更改为更可读的错误消息?实际上,我必须复制URL,删除前缀,然后粘贴到浏览器中,以查看问题所在 例如,将以下异常转换为更有用的错误消息:Javascript 可读的Angular.js错误?,javascript,angularjs,Javascript,Angularjs,默认情况下,Angular.js不提供人类可读的错误消息 是否要将默认的、神秘的Angular.js异常URL更改为更可读的错误消息?实际上,我必须复制URL,删除前缀,然后粘贴到浏览器中,以查看问题所在 例如,将以下异常转换为更有用的错误消息: Error: [ng:areq] http://errors.angularjs.org/1.3.0/ng/areq?p0=InterfaceController&p1=not%20a%20function%2C%20got%20undefin
Error: [ng:areq] http://errors.angularjs.org/1.3.0/ng/areq?p0=InterfaceController&p1=not%20a%20function%2C%20got%20undefined y/<@https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular....
我知道我可以提供自己的异常处理程序:
.factory('$exceptionHandler', function () {
return function errorCatcherHandler(exception, cause) {
console.error(exception);
};
});
我这样做是不是错了?问题是,我是针对缩小/压缩版本开发的(假设它与其他JS库一样)。未压缩版本包含可读的错误消息
https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular.min.js
https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular.js
如果您想在控制台中显示可读错误,请使用角度库的非缩微版本 -- 要知道您当前的错误是什么:复制这些链接并将它们粘贴到浏览器中,它将带您进入页面,在那里您可以阅读有关该特定错误的更多详细信息 我在浏览器url中粘贴了你的错误,得到了
Error: error:areq Bad Argument
Argument 'InterfaceController' is not a function, got undefined
是的,这就是我说的我正在做的。不过我想停止这样做,因为对于大多数简单的错误来说都是浪费时间。非常感谢!你救了我几个小时!!
Error: error:areq Bad Argument
Argument 'InterfaceController' is not a function, got undefined