Hely Saul Oberto
Hely Saul Oberto

Reputation: 597

Print [object HTMLElement] in Angular

Lets say i want to print a variable that i create dinamicly with HTML syntax. In my HTML i want to print the new HTML but i dont know how.

If i print the variable in the HTML, it would print it like a Text.

This is the HTML i want to print:

this.content = this.elementRef.nativeElement.querySelectorAll('sys-tab-content');

but if i print this:

<div>
  {{content[0]}}
</div>

it would just print the text and not like a HTML

EDIT I just want to print this object inside my HTML, excatly as it is.. but When i print it, it just prints what i told you: [object HTMLElement]

Is there a way for me to print this Elements, i know it is not HTML but components.

iConsole log

Upvotes: 1

Views: 4929

Answers (1)

G&#252;nter Z&#246;chbauer
G&#252;nter Z&#246;chbauer

Reputation: 657376

You probably want one of

{{content && content[0].innerText}}
{{content && content[0].innerHTML}}

Upvotes: 2

Related Questions