title: Angular routing not working within component
body: <p>I have 2 components and I want to go from the first to the second component when clicking on a <code>div</code>.</p>
  
  <p>In the first component I did:</p>
  
  <pre><code>export class FirstComponent
  {
      constructor(private router: Router)
      { }
  
      gotoLink(link: string)
      {
          console.log(link);
          this.router.navigate([link]);
      }
  }
  </code></pre>
  
  <p>The <code>link</code> parameter is passed to component from the template and is something like <code>my/second/path</code>.</p>
  
  <p>I created a second component and a module. The module looks like this:</p>
  
  <pre><code>import { NgModule } from '@angular/core';
  import { RouterModule, Routes } from '@angular/router';
  
  import { SecondComponent } from './second.component';
  
  const routes: Routes = [
      {
          path     : 'my/second/path',
          component: SecondComponent 
      }
  ];
  
  @NgModule({
      declarations: [
          SecondComponent
      ],
      imports     : [
          RouterModule.forChild(routes),
      ],
      providers   : [ ]
  })
  export class SecondModule
  {
  }
  </code></pre>
  
  <p>This is the <code>app.module</code>:</p>
  
  <pre><code>import { NgModule } from '@angular/core';
  import { BrowserModule } from '@angular/platform-browser';
  import { HttpClientModule } from '@angular/common/http';
  import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
  import { RouterModule, Routes } from '@angular/router';
  
  import { AppComponent } from './app.component';
  
  
  const appRoutes: Routes = [
      {
          path        : 'private',
          loadChildren: './some/private/path/private.module#PrivateModule'
      },
      {
          path        : '**',
          redirectTo  : 'home'
      }
  ];
  
  @NgModule({
      declarations: [
          AppComponent
      ],
      imports     : [
          BrowserModule,
          BrowserAnimationsModule,
          HttpClientModule,
          RouterModule.forRoot(appRoutes),
      ],
      bootstrap   : [
          AppComponent
      ]
  })
  export class AppModule
  {
  }
  </code></pre>
  
  <p>However, the routing is not working. Am I missing something?</p>