title: Angular 2 - Reload component when routerLink clicked again
body: <p>I am working on Angular 2 project with following file structure.</p>
  
  <ul>
  <li>HeaderComponent.ts</li>
  <li>AppComponent.ts</li>
  <li>Page1Component.ts</li>
  <li>Page2Component.ts</li>
  </ul>
  
  <p>I have following template in my HeaderComponent.ts</p>
  
  <pre><code>&lt;nav class="navbar navbar-default navbar-fixed-top" role="navigation"&gt;
      &lt;div class="container-fluid"&gt;
          &lt;div class="navbar-header"&gt;
              &lt;button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar"&gt;
                  &lt;span class="icon-bar"&gt;&lt;/span&gt;
                  &lt;span class="icon-bar"&gt;&lt;/span&gt;
                  &lt;span class="icon-bar"&gt;&lt;/span&gt;
              &lt;/button&gt;
              &lt;a class="navbar-brand" href="#"&gt;WebSiteName&lt;/a&gt;
          &lt;/div&gt;
          &lt;div class="collapse navbar-collapse" id="myNavbar"&gt;
              &lt;ul class="nav navbar-nav"&gt;
                  &lt;li class="active"&gt;&lt;a [routerLink]="['']"&gt;Home&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a [routerLink]="['/page1']" &gt;Page1&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a [routerLink]="['/page2']"&gt;Page2&lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/nav&gt;
  </code></pre>
  
  <p>with following routes in my AppComponent</p>
  
  <pre><code>@Component({
      selector: 'my-app',
      template: ` 
              &lt;my-header&gt;&lt;/my-header&gt;
              &lt;router-outlet&gt;&lt;/router-outlet&gt;
      `,
      directives: [ROUTER_DIRECTIVES, HeaderComponent]
  })
  @Routes([
      {path: '/', component: HomeComponent},
      {path: '/page1', component: Page1Component}
      {path: '/page2', component: Page2Component}
  ])
  export class AppComponent {
      ngAfterViewInit() {
          //To show the active tab in navbar
          $(".nav a").on("click", function () {
              $(".nav").find(".active").removeClass("active");
              $(this).parent().addClass("active");
          });
      }
  }
  </code></pre>
  
  <p>and my Page1Component has following sample form</p>
  
  <pre><code>&lt;section class="col-md-8 col-md-offset-2"&gt;
      &lt;form [ngFormModel]="myForm" (ngSubmit)="onSubmit()"&gt;
          &lt;div class="form-group"&gt;
              &lt;label for="firstName"&gt;First Name&lt;/label&gt;
              &lt;input [ngFormControl]="myForm.find('firstName')" type="text" id="firstName" class="form-control"&gt;
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
              &lt;label for="lastName"&gt;Last Name&lt;/label&gt;
              &lt;input [ngFormControl]="myForm.find('lastName')" type="text" id="lastName" class="form-control"&gt;
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
              &lt;label for="email"&gt;Mail&lt;/label&gt;
              &lt;input [ngFormControl]="myForm.find('email')" type="email" id="email" class="form-control"&gt;
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
              &lt;label for="password"&gt;Password&lt;/label&gt;
              &lt;input [ngFormControl]="myForm.find('password')" type="password" id="password" class="form-control"&gt;
          &lt;/div&gt;
          &lt;button type="submit" class="btn btn-primary" [disabled]="!myForm.valid"&gt;Sign Up&lt;/button&gt;
      &lt;/form&gt;
  &lt;/section&gt;
  </code></pre>
  
  <p>So when I click on Page1 routerLink in header <code>&lt;li&gt;&lt;a [routerLink]="['/page1']"&gt;Page1&lt;/a&gt;&lt;/li&gt;</code>, it loads the Page1Component in <code>&lt;router-outlet&gt;&lt;/router-outlet&gt;</code>. I fill some details in form and when I click on Page1 routerLink again in header before submitting the form, I want Page1Component to reload so my form comes to initial state but it doesn't do anything on click. I tried to reset form in <code>routerOnActivate()</code> and <code>routerCanDeactivate()</code> but none of the functions being called.  So basically, I want my  component to load again when I click on [routerLink]</p>
  
  <p>Please let me know if I can explain better.</p>