我想捕获在第三方组件中由angularJS引发的事件。
我可以使用以下代码来做到这一点:
class A {
constructor(@Inject('$scope') private $scope) {}
onInit() {
this.$scope.$on('thirdPartyEventName', () => {
console.log('captured');
});
}
}
但是我想要一种不会让我注入$ scope的方法。