My problem is that in angular 4 there are few ways to data bind with HTML to TS like {{myText}}, [], () and other than those we can use [innerHTML]="myText"
what is the best way to bind simple variable to HTML among {{}}, [innerHTML] ?
they are used for different purposes. expression binding ({{}}) outputs raw text, while [innerHTML] outputs HTML formatted text. What is "best" depends on what the variable contains.
htmlString: string = "Hello world"; <!-- if want to display string -->
htmlString: string = "<h1>Hello world</h1>"; <!-- if want to display html element -->
{{}}) outputs raw text, while[innerHTML]outputs HTML formatted text. What is "best" depends on what the variable contains.