Reputation: 1
I created a web js editor with angular and ngx-ace-wrapper lib. Now I trying to output a console.log to HTML div element. But I do not found any solution. How I can get console output or mirror to my DOM.
I tried to override conmsole.log and console.error
"preview" is a variable where I store my output as innerHTML
console.log = message => {
this.preview += message + "\n";
_log(message);
}
console.error = error => {
this.preview += JSON.stringify(error) + "\n";
_error(error);
}
Upvotes: 0
Views: 863
Reputation: 638
To get the HTML to render you can save the HTML in some variable and use the innerHtml
attribute and pass in your html
<div [innerHTML]="myHtml"></div>
Upvotes: 0