I have this XML:
<Label tap="onWorkingHoursDailyViewClick">
<Label.formattedText>
<FormattedString>
<FormattedString.spans>
<Span fontSize="16" text="{{working_hours.status}}" color="{{working_hours.statusColor}}" style="font-weight: bold;"></Span>
<Span fontSize="16" text="{{working_hours.statusText}}"></Span>
<!-- this works -->
<Span text="" fontFamily="FontAwesome"></Span>
<!-- this does not work -->
<Span fontFamily="FontAwesome" text="{{working_hours.isDailyVisibleSign}}"></Span>
</FormattedString.spans>
</FormattedString>
</Label.formattedText>
</Label>
and I have this code behind:
export function onNavigateTo(args) {
// ...
viewModel.set("working_hours", fromObject({
status: "Open",
statusColor: "green",
statusText: " - Closes at 23:00h",
isDailyVisible: false,
isDailyVisibleSign: ""
}));
//...
page.bindingContext = viewModel;
}
export function onWorkingHoursDailyViewClick() {
let workingHours:Observable = <Observable>viewModel.get("working_hours");
if(workingHours.get("isDailyVisible")) {
workingHours.set("isDailyVisibleSign", "  ");
workingHours.set("isDailyVisible", false);
}
else {
workingHours.set("isDailyVisibleSign", "  ");
workingHours.set("isDailyVisible", true);
}
}
It prints "" or "" (with semi-colon) instead of font awesome icons... But it works if I do not use binding...
HI @clzola,
Thank you for the attached code snippet,
While using Icon font and changing the icons code from code behind, you should use the String.fromCharCode converter, which will generate a one-letter string from the character. For more info, you could review this part of the documentation. also for further help, I am attaching a sample project.
Hi @clzola,
Were you able to resolve your case or you still have a problem with using Icon fonts in your project?
Yeah, I have resolved the way you said
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Yeah, I have resolved the way you said