Property 'url' does not exist on type 'Event' for Angular2 NavigationEnd Event


    this.subscription = => {
        console.log(event.url); ##### Error : Property 'url' does not exist on type 'Event'.

Typescript doesn’t recognize the properties of the type Event that is built into the Angular Router. Is there something on tsd that I can use to solve this? Event is the super class of classes NaviagationEnd, NavigationStart


You have to import { Event } from @angular/router;. Try moving console into the if block with condition.

this.subscription = => {
  if(event instanceof NavigationEnd ){

Answered By – Arpit Agarwal

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published