Angular Router Events

    0

    0

    Jose Romero

    Angular TypeScript Recipes

    The code defines a function called checkEvents. Within this function, the code subscribes to the events property on the router object. This property contains events that are raised by the browser.

    When an event is raised, the code checks to see if the event instance is the eventName object. If it is, the code breaks out of the function. If it is not, the code simply breaks out of the function.

    Library: angular

    Shortcut: angular.router.events

    checkEvents() {
      this.router.events.subscribe(event => {
        switch (true) {
          case event instanceof eventName:
            break;
          default:
            break;
        }
      });
    }
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    Legal
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.