I am having some trouble trying to find a workaround to this:
In one hand I've got defined my routes like the following:
const appRoutes: Routes = [
{ path: '**', component: TemplateComponent, pathMatch: 'full' }
];
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);
So based on the URL the TemplateComponent would fetch a different html template:
@Component({
templateUrl: this.document.location.pathname
})
In the other hand, my backend server generates some HTML output like the following:
<nav>
<a routerlink="/content/mysite/t1.html" href="/content/mysite/t1.html">Template 1</a>
<a routerlink="/content/mysite/t2.html" href="/content/mysite/t2.html">Template 2</a>
<a routerlink="/content/mysite/t3.html" href="/content/mysite/t3.html">Template 3</a>
</nav>
So the issue I am facing is that when clicking on any of the generated links, Angular does not fetches the template, nor initialises the component, this is done only once when the AppModule is loaded.
I found some articles discussing about having to implement a subscriber, although after going through the Angular 4 documentation and unsuccessfully trying different things I ended up lost.
It would be great if anyone could shed some light.