Font-Awesome + MySQL. Icon not display correctly


#1

Hi

I have some icon values stored in a MySQL db, as VARCHAR.

I’m trying to get this values and show them in my app as real icons.

I get all stuff using php, and converting the result to json.

For instance, I get this string from mysql:

valueFromJson = "0xf073"

, and I apply it:

<Label [text]="valueFromJson" class="font-awesome"></Label>

the result is:

test

instead of the icon symbol…

Any idea to solve it?

Thanks.


#2

@ParVis
You need a semicolon at the end of it, also it would look
something like &#xf073;

and if that doesn’t work, you can try storing the Unicode value of it,

so, 0xf073 is fa-calendar, the Unicode of it is, \uf073

refer http://fontawesome.io/icon/calendar/ for the unicode value
and http://fontawesome.io/cheatsheet/ for getting the hex value.

Cheers!


#3

Thanks @multishiv19 !!

The way that works for me is using unicode: \uf073


#4

@ParVis
In my experience, I’ve noticed that when you want to use font awesome via data binding, then only unicode way works,
and when you want to use it directly in the xml, then the hex code way works.