javascript - 通用Ajax错误处理-Angular JS中的拦截器

标签 javascript angularjs error-handling

我想在我的angular Js Application中实现Ajax调用的全局错误处理。我认为$ httpprovider仅适用于$ http请求。请指导我实现这一目标。我该如何编写拦截器来捕获Ajax调用的失败。我的主要目标是捕获Ajax调用Google Analytics(分析)失败的情况。

最佳答案

在javascript try-catch

http://www.w3schools.com/js/js_errors.asp
中编写ajax调用

关于javascript - 通用Ajax错误处理-Angular JS中的拦截器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37046185/

相关文章:

c++ - 从 GetLastError() 函数返回的错误代码中获取文本

javascript - 具有多种表单的表单插件 |提交返回最后一个表格

javascript - Azure Functions 和 webPubSub : get the number of clients

javascript - 在 Derby.js 中包含 JS 文件

javascript - AngularJS 初始路由 Controller 未加载。后续的都还好

t-sql - 我是否必须在 T-SQL 中的 catch block 中回滚事务之前对事务进行计数?

javascript - 以表格格式显示 Ajax 返回的数据

javascript - 从浏览器控制台更改属性不会触发绑定(bind)

javascript - AngularJS:ng-click 具有功能并更改变量的状态

python - 在 flask 中配置数据库