I'm using the mean stack with Angular 6 and i'm currently creating a notification system. I'm getting 'events' from my database and I want to be able to display their messages which may contain url links to other parts of the site. For example one might contain a message which is:
New job created <a [routerLink]="['/job', job._id]">{{jobName}}</a>
I can't use innerHTML as it strips the routerLink. So how do I evaluate it as a link?
I've tried ng-dynamic as suggested here: Angular2 Dynamic HTML with functional RouterLink
However I get the following error:
Uncaught TypeError: _angular_compiler__WEBPACK_IMPORTED_MODULE_1__.JitCompilerFactory is not a constructor
{prefix, suffix, url, label}instead of ready HTML and then create template{{prefix}}<a [routerLink]="url">{{label}}</a>{{suffix}}. Maybe you even don't need suffix.@HostListener('click', [...]) onClick(button: number, ctrlKey: boolean, metaKey: boolean, shiftKey: boolean): boolean { [...] this.router.navigateByUrl(this.urlTree, extras); return false; }