Angular 4 Get current route

import { Component } from '@angular/core';
import { Router, NavigationEnd } from '@angular/router';


export class MyComponent {

  constructor(private router:Router) { => {

      if (event instanceof NavigationEnd ) {
        console.log("current url",event.url); // event.url has current url
        // your code will goes here

Author: Pankaj Anupam

I am a Full Stack Web developer working in AngularJS, ReactJS, NodeJS, Javascript & PHP. I am using technologies like HTML5, CSS3, Sass, Bootstrap, D3, Grunt, Bower, CoffeeScript, MongoDB, Graph Database, Sql & Jade. I have hands-on experience of web & mobile optimized application development.

Leave a Reply

Your email address will not be published. Required fields are marked *