I have a Navigation bar in Angular 2. It works like below.
<nav class="navbar navbar-toggleable-md navbar-light bg-faded">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">App</a>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a routerLink="/dashboard" routerLinkActive="active" class="nav-link">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a routerLink="/grid" routerLinkActive="active" class="nav-link" >Grid</a>
</li>
<li class="nav-item">
<a routerLink="/reporting" routerLinkActive="active" class="nav-link" >Reporting</a>
</li>
</ul>
</div>
</nav>
And each tab loads 1 component. So dashboard loads DashboardComponent and grid loads a GridComponent.
Both component mentioned above gets data from a data.service.ts. My question: is there a way to click on dashboard (it loads after 3 seconds), and then navigate away from dashboard tab to the grid tab. Then when I go back to the dashboard tab, can it not reload and take the 3 seconds time again??
The app we wrote in Angular 1.5 doesn't have the above problem. The issue is if the user is switching between dashboard and grid, it takes a lot of time.
I looked at the following questions asked here: Bootstrap's tabs with data-toggle cause reload in angularjs
Angular2 router.navigate refresh page
They both don't solve my problem. first question is for angular 1. and the second question, when I make my nav items into type="button", the reloading is still happening.