title: Act when lazy loaded module is destroyed
body: <p>I have an Angular 6 application and I am lazy loading a module and passing some data via the router. 
  Once in the module, I call a method within a shared service to which I pass this data (config stuff).</p>
  
  <p>I need to call a method when that module is destroyed (essentially, when the user leaves that path), but I want to call it only once, so I want to avoid having to watch the route changing constantly as this will be expensive. The reason is I need to reset the shared service configuration. Basically, I have certain configuration data for the application, and I need to override it for the lazy-loaded module, but put it back once the user is not in the module.</p>
  
  <p>I am trying to call the function on the OnDestroy hook of the module but it is not triggered. </p>
  
  <p>Routing module:</p>
  
  <pre><code>const appRoutes: Routes = [
      {
          path: 'lazy',
          loadChildren: 'lazy.module#LazyModule',
          data: {
              test: 'data'
          }
      },
      {
          path: 'home',
          loadChildren: 'home.module#HomeModule',
      },
  {
          path: '**',
          redirectTo: '/home'
      }
  ]
  </code></pre>
  
  <p>Lazy loaded module:</p>
  
  <pre><code>export class LazyModule implements OnDestroy {
  
      constructor() {
          console.warn('LazyModule launched!'); // I see this
      }
  
      ngOnDestroy() {
          console.warn('destroyed'); // This is not triggered
      }
  
  }
  </code></pre>