I am playing with tutorial Tour of Heroes found here. Everything runs and looks fine. However, after I added routing from root page to dashboard and to hero's detail, I got the following error in the console:
Unexpected condition on http://localhost:3000/dashboard: should only include this file once
The error is seen after I click in the link to Dashboard. The message is thrown from that line of code:
expect(!loadTimeData, 'should only include this file once');
in VM1812:155. JS version is V8 5.6.326.50. Version of Angular I am using is 4.0.0, as declared in package.json:
"dependencies": {
"@angular/common": "~4.0.0",
"@angular/compiler": "~4.0.0",
"@angular/core": "~4.0.0",
...
}
dashboard.component.ts
import { Component, OnInit } from '@angular/core';
import { Hero } from '../heroes/hero';
import { HeroService } from '../model/hero.service';
@Component ({
selector: 'my-dashboard',
templateUrl: './html/dashboard.component.html',
styleUrls: ['./css/app.css'],
})
export class DashboardComponent implements OnInit {
heroes: Hero[] = [];
constructor(private heroService: HeroService) { }
ngOnInit(): void {
this.heroService.getHeroes()
.then(heroes => this.heroes = heroes.slice(1, 5));
}
}
The /dashboard page is linked in app.component template, like that:
<nav>
<a routerLink="/heroes">Heroes</a><!--another page, also problematic-->
<a routerLink="/dashboard">Dashboard</a>
</nav>
<router-outlet></router-outlet>
and route definition is defined in a module like that:
@NgModule({
imports: [ RouterModule.forRoot(
[
{ path: '', redirectTo: '/dashboard', pathMatch: 'full' },
{ path: 'dashboard', component: DashboardComponent },
]
) ],
//...
})
Anyone knows what this error means and why it pops up?