title: Angular get the current routes
body: <p>I'm trying to create the custom breadcrumb. I would like to get the current routes without dataid. </p>
  
  <p>I have tried the below but it is coming with data ID and routing is not working.</p>
  
  <p>Expert advice please.</p>
  
  <p>Actual link: <a href="http://localhost:4200/settings/data?dataId=1100" rel="nofollow noreferrer">http://localhost:4200/settings/data?dataId=1100</a></p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;ul &gt;
    &lt;li class="breadcrumb-item" *ngFor="let breadLink of breadcrumbListObj"&gt;&lt;a [routerLink]="breadLink.link"&gt;{{breadLink.name}}&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p><strong>TS</strong></p>
  
  <pre><code> import { Component, OnInit } from '@angular/core';
      import { Location } from '@angular/common';
      import {Router, ActivatedRoute, NavigationEnd, RoutesRecognized, Params, PRIMARY_OUTLET} from '@angular/router'
      constructor(location: Location, activate: ActivatedRoute, router:Router) {
  
        router.events.subscribe((val) =&gt; {
        if (location.path() !== '') {
          this.route = location.path();
          this.breadcrumbListArray = this.route.split('/');
          for(let d of this.breadcrumbListArray) {
           this.breadcrumbListObj["link"] = "/" + d;
           this.breadcrumbListObj["name"] = d;
          }
        }
  
    });
  </code></pre>
  
  <p><strong>Expected breadcrumb path is => settings/data with respective routes on click on settings</strong> </p>