1

I want to load the fonts dynamically in my angular 5 project and it is working fine when I use

<i data-icon="&#xe04a;" ></i>

but when I load the value dynamically in angular 5 by using

<i [attr.data-icon]="w" ></i>

In the component.ts file w value is same w= "&#xe04a;" then its not working.

But when I saw in console both scenarios then for the first scenario data-icon value turns into an utf code but for the [attr.data-icon] it show the value "&#xe04a;"

sg7
  • 6,108
  • 2
  • 32
  • 40
smith felk
  • 49
  • 5
  • Possible duplicate of [Insert Unicode character into JavaScript](https://stackoverflow.com/questions/13093126/insert-unicode-character-into-javascript) – Daniel W Strimpel Mar 31 '18 at 03:46

1 Answers1

0

When using dynamic data, you should use w = String.fromCharCode(0x04a) or w = '\u004A'

Please, refer to this answer https://stackoverflow.com/a/13094667/8038345

Gustavo Lopes
  • 3,794
  • 4
  • 17
  • 57