How to pass dynamic html to handy-syntax-highlighter in angular 4? -
i have implemented code highlighter in angular 4 application. tried pass dynamic content handy-syntax-highlighter. not working. displaying first value. html template below.
<handy-syntax-highlighter [language]="'html'" [content]="this.htmlstrin"></handy-syntax-highlighter> here component code:
export class ngbdmodalcontent implements oninit { @input() name; @viewchild('myform') form; message :string; htmlstrin : string; contentobj: any; constructor(public activemodal: ngbactivemodal, private dataservice: dataservice, private renderer: renderer2, private ref:changedetectorref ) { this.htmlstrin = '<div></div>'; } ngoninit() { } ngafterviewinit() {} componentlist = componentlist; showcodewindow = false; dropdownscomponent(data){ var content = data.html; (let level1 of content) { this.htmlstrin = this.generatehtml(level1); console.log(this.htmlstrin); (let level2 of level1.html) { this.htmlstrin +=this.generatehtml(level2); if(level2.html.length> 0){ (let level3 of level2.html) { this.htmlstrin += this.generatehtml(level3); this.htmlstrin = this.htmlstrin.tostring(); } } } } } }
Comments
Post a Comment