0

I would like to put an HTML Code into a AngularJS variable and display it. In my example I am trying to displaying a checkmark character. https://www.toptal.com/designers/htmlarrows/symbols/check-mark/

The below code does work correctly:

<label>&#10003;</label>  

But this does not work, because the CheckMark variable is seeing it as an exact string:

<label>{{CheckMark}}</label>  

$scope.CheckMark = "&#10003;";

I would still like to keep CheckMark a string variable (because sometimes it should just be normal text) but how can I make it display this checkmark correctly?

Freddy Bonda
  • 919
  • 4
  • 9
  • 25
  • The duplicate answers the question in the title, but I'd use a literal checkbox character (or a JavaScript escape) instead of HTML when writing JavaScript. – Quentin Sep 12 '18 at 09:54
  • @Quentin Would you mind explaining "but I'd use a literal checkbox character"? Would you give me an example of this please – Freddy Bonda Sep 12 '18 at 09:56
  • Example of a literal checkbox character: `✓` – Quentin Sep 12 '18 at 09:57

0 Answers0