Function got undefined on onclick()

You need to use ViewContainerRe.createEmbeddedView. Otherwise angular won’t add bindings to dynamically inserted HTML.

Also this inside of onclick refers to HTML element in case of plain Dom events. That’s why it doesn’t work

Check the source of ngIf to get an idea of how this can be done.

Another approach is to Use event delegation + event target and attrs on a tags

'<a data-event="issue:display">' + issueType + '</a>'

Then in component

@HostListener('click', ['$event.target'])
publishEvent(target) {
  this.events.publish(target.getAttribute("data-event")
}