title: Angular lazy loading: route to a specific feature component
body: <p>I'm trying to implement angular 6 lazy loading and I would like to have links in my main homepage that points each one to a specific feature component.</p>
  
  <p>My project's hyerarchy is as it follows:</p>
  
  <pre><code>app.module.ts
  |__homepage.component.ts
  |__options.component.ts
  |__feature.module.ts
     |__buy.component.ts
     |__sell.component.ts
  </code></pre>
  
  <p><strong>From the <code>homepage.component</code>, user might be able to directly access <code>buy.component</code> and <code>sell.component</code>.</strong></p>
  
  <p>How should the routes or the links in <code>homepage.component</code> be structured in order to achieve this?</p>
  
  <p>As you can notice from my code below, my lazy loading routes only points to the module, but the <code>''</code> route - which is triggered by default - is not always the one that the user would like to visit <em>(if he/she clicked on "sell", he would like to view sell component and vice versa for "buy")</em> and I would like to avoid creating a sub-home page for each module…</p>
  
  <p>Here's my code on the routes so far:</p>
  
  <blockquote>
    <p><strong>app.routing.ts</strong></p>
  </blockquote>
  
  <pre><code>const routes: Routes = [
    {
      path: '',
      redirectTo: '/home',
      pathMatch: 'full'
    },
    {
      path: 'home',
      component: HomeComponent
    },
    {
      path: 'options',
      component: OptionsComponent
    },
    {
      path: 'buy',
      loadChildren: "../app/posts/feature.module#FeatureModule"
    },
    {
      path: 'sell',
      loadChildren: "../app/posts/feature.module#FeatureModule"
    }
  ];
  </code></pre>
  
  <blockquote>
    <p><strong>feature.routing.ts</strong></p>
  </blockquote>
  
  <pre><code>{
      path: '',
      redirectTo: '/buy',
      pathMatch: 'full'
    },
    {
      path: 'buy',
      component: BuyComponent
    },
    {
      path: 'sell',
      component: SellComponent
    }
  </code></pre>
  
  <p><em>PS: I'll be available for any clarification if needed</em></p>