I want to add a routerLink to the Host Element in an Angular Component like this:
@HostBinding('routerLink') routerLink = '/my-route'
But when I click the component, it wont navigate to the specified route. What am I doing wrong? Is this even possible with Angular 11?
EDIT:
I also tried the old way of host binding (that is not recommended by tslint: Use @HostBinding or @HostListener rather than the
host metadata property (https://angular.io/styleguide#style-06-03) (no-host-metadata-property)tslint(1)
:
host: {
'[routerLink]': '[\'/my-route\']'
},
There is no router navigation following this either.