My question is very similar to this but it's not working for me. I already asked the person who post it but I got no reply, so here I go. I basically want to generate links from a function:
generator(linkFor, linkPath){
if (linkFor == 'msg'){
// now linkPath is something like 2/4
// and the route to read the message is message/view/2/4
return 'message/view/' + linkPath
}
}
and the if conditions do go on. From template I do:
<a href="javascript:void(0)" [routerLink]="generator(data.type, data.source)">{{data.source_name}}</a>
Now the link is being generated but adds ():
message/view/(2/4)
and thus, it can't be found. Where are the braces coming from?