Hi Scott, I like Sander's simple solution, but I have not yet been able to get it to work.
My updated code follows. What I am seeing in the debugger is elmChild does not have any children. The structure all looks good, but no childNodes. You can try it yourself at my website <https://tanglemydata.com/#/app-views/forum/post-view?postID=3>. See elmChild in function getProfileAnchorFrag(). Thanks, Bob getProfileAnchor(publicProfile: any): string { return `<a (click)='showProfileDialog("<b>TEST</b>")'>Click Me</a><br>`; } getProfileAnchorFrag(publicProfile: any): any { const html = this.getProfileAnchor(publicProfile); console.log("PostViewComponent getProfileAnchorFrag - html: " +html); const frag = document.createRange().createContextualFragment(html); // this.elm.innerHTML = ''; //keep existing innnerHTML const elmChild = this.elm.appendChild(frag); const result = elmChild.firstChild; return result; } getHtmlRow(postContent: string, creatorName: string, creationDate: string, publicProfile: any, postAttachments: string): any { const result = ` <tr> <td class="text-center" style="width: 12%;"> ` +this.getProfileAnchorFrag(publicProfile) +` <small>` +publicProfile.postCnt +` Posts</small> </td> <td> <strong>` +creatorName +`</strong> on <em>` +creationDate + `</em> <br><br>` +postContent +` ` +postAttachments +` </td> </tr> `; return result; } On Sunday, January 20, 2019 at 9:21:08 PM UTC-8, Scott L wrote: > > I asked a similar question awhile back and Sander responded with a link to > his online repository - which answered my question. You can find his answer > here: > > > https://github.com/SanderElias/Samples/blob/master/src/app/html-load/htmlload/htmlload.component.ts > > On Sunday, January 20, 2019 at 2:12:49 AM UTC-7, Bob Carpenter wrote: >> >> Hi Sander, >> >> I appreciate your help. Would you mind editing the first sentence? Not >> sure which is "can" and which is "cannot". >> >> Is there an example you can point me at? >> >> Thanks, >> >> Bob >> >> >> >> On Saturday, January 19, 2019 at 5:24:49 AM UTC-8, Bob Carpenter wrote: >>> >>> I posted this subject at StackOverflow >>> <https://stackoverflow.com/questions/54158786/angular5-how-to-pass-html-tagged-string-that-includes-function-call> >>> last >>> week, but I am not getting any responses.I didn't want to post in both >>> areas, so I'm linking to the SO topic, rather than duplicate it. >>> >>> I'm hoping someone in this group can help with an answer. If you can, >>> either post here, or at SO. I will keep this group and SO updated with any >>> results. >>> >>> Thanks, >>> Bob >>> >> -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.