Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Scope $on listen for all events #3779

@steelsojka

Description

@steelsojka

I'm looking for a way to listen for all events being emitted through the scope hierarchy. My goal is to emit events upward and bounce them back down from a controller to "self contain" components. Basically if something doesn't intercept the event and stop propagation it will make it up to my app controller and then get relayed back down globally. I can't emit down from the $rootScope since the components could be self contained and the events can't be global in that sense. I was thinking of maybe a wildcard event or something of that nature.

$scope.$on("*", function() {
  $scope.$broadcast("myRecievedEvent"); // Some other logic here
});

There might be a better way to do this, but it might useful to have this functionality? If anybody has any ideas please share!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions