title: Angular 2/4: Routing is not working
body: <p>My routing </p>
  
  <pre><code>   RouterModule.forRoot([
              { path: 'login', component: LoginComponent },
              { path: 'home', component: HomeComponent },
          ])
  </code></pre>
  
  <p>In app component I have      this.router.navigate(['home']);
  This doesn't navigate me to home component.</p>
  
  <p><a href="https://i.stack.imgur.com/rYJWa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rYJWa.png" alt="enter image description here"></a></p>
  
  <p>When I routed to login page, my left nav is also displayed.</p>
  
  <p>My app.component.ts</p>
  
  <pre><code>&lt;div class='container-fluid'&gt;
      &lt;div class='row'&gt;
  
          &lt;div class='col-sm-3'&gt;
              &lt;nav-menu&gt;&lt;/nav-menu&gt;
          &lt;/div&gt;
  
          &lt;div class='col-sm-9 body-content'&gt;
              &lt;router-outlet&gt;
                  &lt;input style="float:right" placeholder="Search" autofocus&gt;
              &lt;/router-outlet&gt;
          &lt;/div&gt;
  
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>