title: Reset ActivatedRoute in Angular 4
body: <p>There is some code I was using that builds up a series of breadcrumb links via a do while loop. The loop terminates when the ActivatedRoute is null as below:</p>
  
  <pre><code> constructor(
      private router: Router,
      private route: ActivatedRoute
    ) {
        this.router.events.filter(event =&gt; event instanceof NavigationEnd).subscribe((event) =&gt; {
        this.breadcrumbs = [];
        let currentRoute = this.route.root,
        url = '';
        do {
          const childrenRoutes = currentRoute.children;
          currentRoute = null;
          childrenRoutes.forEach(route =&gt; {
            if (route.outlet === 'primary') {
              const routeSnapshot = route.snapshot;
              url += '/' + routeSnapshot.url.map(segment =&gt; segment.path).join('/');
              this.breadcrumbs.push({
                label: route.snapshot.data,
                url:   url
              });
              currentRoute = route;
            }
          });
        } while (currentRoute);
      });
  </code></pre>
  
  <p>After updating to Angular 4.4.4 and TypeScript 2.5.3 the following assignment no longer compiles:</p>
  
  <pre><code>currentRoute = null;
  </code></pre>
  
  <p>where current route is an ActivatedRoute.</p>
  
  <blockquote>
    <p>Type null is not assignable to type ActivateRoute</p>
  </blockquote>
  
  <p>I've tried         </p>
  
  <pre><code>private route: ActivatedRoute | any
  </code></pre>
  
  <p>but that in turn breaks other parts of the method. So im not sure if i should be fixing those issues or resetting ActivatedRoute in a more appropriate way.</p>