diff --git a/public/app/core/utils/emitter.ts b/public/app/core/utils/emitter.ts index 045182c76d1..5de9dc78cfa 100644 --- a/public/app/core/utils/emitter.ts +++ b/public/app/core/utils/emitter.ts @@ -21,13 +21,13 @@ export class Emitter { this.subjects[fnName].next(data); } - on(name, handler, $scope) { + on(name, handler, scope?) { var fnName = createName(name); this.subjects[fnName] || (this.subjects[fnName] = new Subject()); var subscription = this.subjects[fnName].subscribe(handler); - if ($scope) { - $scope.$on('$destroy', function() { + if (scope) { + scope.$on('$destroy', function() { subscription.unsubscribe(); }); }