正如您所说,由于开销的原因,这不太可能实现。
但是,可以在您自己的应用程序中实现通知程序,以便您可以创建一种使用装饰器通知您自己的应用程序的方法。
app.config(function($provide) {
$provide.decorator("$rootScope", function($delegate) {
var Scope = $delegate.constructor;
var origBroadcast = Scope.prototype.$broadcast;
var origEmit = Scope.prototype.$emit;
Scope.prototype.$broadcast = function() {
console.log("$broadcast was called on $scope " + $scope.$id + " with arguments:",
arguments);
return origBroadcast.apply(this, arguments);
};
Scope.prototype.$emit = function() {
console.log("$emit was called on $scope " + $scope.$id + " with arguments:",
arguments);
return origEmit.apply(this, arguments);
};
return $delegate;
});
});
这是一个简单的例子: http :
将来,请考虑在发布问题之前询问邮件列表、 IRC 频道或stackoverflow ,但是 --- 这主要用于错误跟踪。
喔,不错。 谢谢凯特琳。
另外,注意到; 我的错
2014 年 1 月 29 日,星期三,Caitlin Potter通知@ github.com
写道:
以后请考虑询问邮件列表https://groups.google.com/forum/#!forum/angular ,
IRC 频道http://webchat.freenode.net/?channels=angularjs或
然而,在发布问题之前,stackoverflow http://stackoverflow.com/questions/tagged/angularjs --- 这主要是为了错误
追踪。—
直接回复本邮件或在Gi tHub上查看
.
最有用的评论
正如您所说,由于开销的原因,这不太可能实现。
但是,可以在您自己的应用程序中实现通知程序,以便您可以创建一种使用装饰器通知您自己的应用程序的方法。
这是一个简单的例子: http :