I have problem with generated routing link in component from shared module.
Here is the plunker.
There are 3 links in navigation menu. When I click on "Information" the page shows correctly and there should be link to Health. But Angular does not parse template and <a>
tag being there has no added attribute href
.
The same html code
<a routerLink="/health">Health</a>
is used both in menu (where it behaves correctly) and in LandingComponent
template.
What and where should I import to have both links working?
Your LandingComponent is a part of SharedModule. Thus you have to import RouterModule into the SharedModule to make the link work in your LandingComponent, here's a correct code for SharedModule:
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { LandingComponent } from './landing.component';
@NgModule({
imports: [RouterModule],
exports: [LandingComponent],
declarations: [LandingComponent]
})
export class SharedModule { }