I have a component similar to the one in this example link:
@Component({
template: `
<p [innerHTML]="link"></p>
`,
directives: [ROUTER_DIRECTIVES]
})
@RouteConfig([
{ path: '/two', component: Two, name: 'Two'},
])
export class App {
two = (text: string) => `<a [routerLink]="['/Two']">${text}</a>`;
constructor(private _router: Router) { }
ngOnInit() {
this.link = `${this.two("two")}`;
}
}
Can anyone help me figure out why it's not compiling the link
value or suggest a way to fix it? My intention is to set the URL statically and only modify the text of the generated link.
UPDATE:
I also attempted:
two = (text: string) => `<a href="/two">${text}</a>`;
It works in plunker with #/two
due to HashLocationStrategy, but in my application router fails to detect the link causing the entire page to reload...