How can I make my xAxis labels links to other parts of my app with routerLink directive?
Say:
xAxis: {
categories: [{
name: 'Yanick',
id: '1'
}, {
name: 'Mathieu',
id: '2'
}, {
name: 'Bob',
id: '3'
}, {
name: 'Richard',
id: '4'
}, {
name: 'Linda',
id: '5'
}],
labels: {
formatter: function(){
return '<a href="' + 'http://localhost:4200/employee/' + this.value.id + '">' + this.value.name + '</a>';
},
useHTML: true
}
},
I want to be able to navigate to a specific employee page by clicking on one of the x axis label. It works with the href="". So far so good, but I want to use the Directive routerLink instead of href. To do so i'd need to do something like this:
labels: {
formatter: function(){
return '<a [routerLink]="['+ '/employee' +', '+ this.value.id +']">' + this.value.name + '</a>';
},
useHTML: true
}
},
But when I click on one of the labels nothing is happening... Any idea why? How to fix this? Is it even possible to use a directive in the formatter function? Should I try another approach?
thanks for the answers!