title: Check angular route path from interceptor
body: <p>I have a route path configured as:</p>
  
  <pre><code>{
      path: 'user/:id/edit/:type',
      component: UserEditTypeComponent,
  },
  </code></pre>
  
  <p>I want to reach the path from the interceptor which i could access from activated routes as:</p>
  
  <pre><code>constructor(private activatedRoute: ActivatedRoute) {
  }
  
  ngOnInit() {
      console.log(this.activatedRoute.routeConfig.path);
  }
  </code></pre>
  
  <p>This results in returning this path <code>user/:id/edit/:type</code> in the console.</p>
  
  <p>I want to get the same path from interceptor which i have tried as:</p>
  
  <pre><code>intercept(req: HttpRequest&lt;any&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;any&gt;&gt; {
      let ar = this.injector.get(ActivatedRoute);
      console.log(ar.routeConfig.path);
  }
  </code></pre>
  
  <p>this returns error as: <code>Cannot read property 'path' of null</code>. I have removed the path and tested and found <code>routeConfig</code> to be null.</p>
  
  <p><strong>How do we get the activated route inside the interceptor?</strong></p>
  
  <p>Is there any other method to access the <code>path</code> in interceptor?</p>
  
  <p>If the question seems to be unclear could updated it with more information.</p>