![](/img/trans.png)
[英]How do I populate the 'cause' parameter of $exceptionHandler?
[英]When implementing a custom $exceptionHandler in angularJS, how do I preserve default log?
我正在使用自定義angularJS $exceptionHandler
(將客戶端異常發送到我的服務器):
app.factory('$exceptionHandler', function() {
return function(exception, cause) {
//custom handling of the exception
//...
};
});
如何保留默認控制台日志?
可以使用$log
保留默認$log
:
app.factory('$exceptionHandler', ['$log', function($log) {
return function(exception, cause) {
//custom handling of the exception
//...
$log.error.apply($log, arguments);
};
}]);
有關此博客文章的更多信息。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.