Closed rynop closed 5 years ago
The answer is to use Formatted String.
Ex:
<Button (tap)="onTap($event)" class="btn btn-primary">
<FormattedString>
<Span class="fas" text="{{'fa-film' | fonticon}}"></Span>
<Span text=" Test" fontAttributes="Bold"></Span>
</FormattedString>
</Button>
I'm running into a
font-family
collision when trying to use a icon font on a<Button>
.Ex:
css:
When using the Nativescript themes, it defines the
font-family
for the.btn
class. As you know iconfonts rely onfont-family
as well.So in the button above how do apply one
font-family
to the stringTest
while applying anotherfont-family
to the icon?If you use the NativeScript Angular SASS starter app and define
.fas
in_app-common.scss
and use my button above, you will see that the icon displays as a?
. This is because.btn
is overriding thefont-family
.I could solve this by giving the icon
font-family
a higher precedence - but this would prevent me from styling the textual font on the button.Non-nativescript impelmentations of font icons inside buttons solve it by being able to put an element (like
<span>
) as a child element to<Button>
. Example here.How can you accomplish this with NativeScript
<Button>
?