Skip to content

FontIcon not working in ActionItem #1483

@SGissubel

Description

@SGissubel

Which platform(s) does your issue occur on?

  • iOS emulator

tns version: 4.1.2
Cross-platform modules: "version": "4.1.1"
"tns-ios": "version": "4.1.1"

Please, tell us how to recreate the issue in as much detail as possible.

Using fonticon with my Nativescript-angular app. I have followed all of the instructions and have even debugged several items.

It displays the icon in Label BUT the layout gets completely messed up:

<ActionBar [title]="user.userName">
...
  <Label
    class="fa"
    [text]="'fa-cog' | fonticon"
    ios.position="right"
    android.position="right"></Label>
</ActionBar>

Results in:
image

What I need is to use ActionItem:

<ActionBar [title]="user.userName">
  <ActionItem
    class="fa"
    [text]="'fa-user-plus' | fonticon"
    ios.position="left"
    android.position="left"></ActionItem>
  <ActionItem
    class="fa"
    [text]="'fa-cog' | fonticon"
    ios.position="right"
    android.position="right"></ActionItem>
</ActionBar>

But results in:
image

In my app.scss:

.fa {
  font-family: FontAwesome, fontawesome-webfont;
}

(I tried using a capital F in Font-family - no change.)

My app module:

import { NgModule } from "@angular/core";
import { NativeScriptModule } from "nativescript-angular/nativescript.module";
import { NativeScriptFormsModule } from 'nativescript-angular/forms';
import { NativeScriptHttpModule } from 'nativescript-angular/http';
import { NativeScriptRouterModule } from 'nativescript-angular/router';
import { ReactiveFormsModule } from '@angular/forms';

import { TNSFontIconModule, TNSFontIconService } from 'nativescript-ngx-fonticon';

import { MinLengthDirective, IsEmailDirective } from "./directives/input.directive";
import { AppComponent } from "./app.component";
import { routes, navigatableComponents } from './app.routing'
// TNSFontIconService.debug = true;
@NgModule({
  imports: [
  	NativeScriptModule,
  	NativeScriptFormsModule,
  	NativeScriptHttpModule,
  	NativeScriptRouterModule,
  	NativeScriptRouterModule.forRoot(routes),
  	TNSFontIconModule,
  	ReactiveFormsModule,
  	TNSFontIconModule.forRoot({
			'fa': './assets/fontawesome.scss',
		})
  ],
  declarations: [
  	MinLengthDirective,
  	IsEmailDirective,
  	AppComponent,
  	...navigatableComponents
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}

In my fonts folder I have:
fontawesome-webfont.ttf & FontAwesome.ttf

In my assets folder I have:
fontawesome.css(the compiled form of -->) fontawesome.scss

Desired output:

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions