【发布时间】:2013-05-10 18:57:14
【问题描述】:
对于一个应用,我使用的骨架与https://github.com/angular/angular-seed 非常相似。
我在 services.js 中尝试过这样的事情:
'use strict';
/* Services */
angular.module('mApp.services', []).
factory('$exceptionHandler', function () {
return function (exception, cause) {
alert(exception.message);
}
});
这并没有做任何事情,它似乎没有覆盖异常处理程序。
如果我尝试:
var mod = angular.module('mApp', []);
mod.factory('$exceptionHandler', function() {
return function(exception, cause) {
alert(exception);
};
});
它会覆盖整个应用程序。
如果我使用类似于默认 Angular 应用的骨架,如何正确覆盖 exceptionHandler?
【问题讨论】:
标签: javascript angularjs