Ngx-admin: how to change the icons in pages-menu.ts?

Created on 13 Mar 2018  路  10Comments  路  Source: akveo/ngx-admin

Issue type

I'm submitting a ... (check one with "x")

  • [ ] bug report
  • [ ] feature request
  • [x] question about the decisions made in the repository

Hi, I would like to ask how to use local icon in the page-menu.ts.
To be exactly:
I have a .png file in folder ./assets. In the page-menu.ts the icon is defined in the following part:

    title: 'Forms',
    icon: 'nb-compose',
    children: [ ... ]

How could I use the png file as icon? Thanks for the help!

question

Most helpful comment

Hi @LucasMeier, you need to create a css class per each of your icons and then pass the class name in the menu configuration:

.my-icon {
  background: url(...);
} 
{
title: 'home:,
icon: 'my-icon',
}

Hope this helps.

All 10 comments

As far as I know (I'm a newbie) , I add a urlLink into menu object in ROUTER object in pages.menu.ts
Like this:
menu: {
title: 'general.menu.dashboard',
icon: 'ion-android-home',
selected: false,
expanded: false,
order: 0,
urlLink : yourURL
}
Then you add below the element

{{ menuItem.title }}



@hntvip Thanks for the help. I tried with your method but sadly it doesnot work for me.

Hi @LucasMeier, you need to create a css class per each of your icons and then pass the class name in the menu configuration:

.my-icon {
  background: url(...);
} 
{
title: 'home:,
icon: 'my-icon',
}

Hope this helps.

@nnixaa hello, where the css file can I create

@nnixaa I've done this as described in a styles.css file in the src folder, (included in angular-cli.json) and the icon does not appear in the menu. Could you elaborate on how to get it to work please?

@nnixaa
I tried by the instruction you mentioned to change the icon.
But it is not working!
How can I change the icon?

Has anyone found a working solution for custom icons? I've tried customizing sidebar menu icons with my own assets using @nnixaa suggestions and no luck so far.

Facing this issue as well. Any help would be appreciated!
How to have customizable icons in the menu (pages-menu.ts) ?

I'm using this =>
icon: 'fa fa-home',
and import Font-Awesome in styles.

Actually you could change the "menu-item.component.html" in nebular/theme/components/menu. There you can change the following:

class to whatever is needed.

@Cloudkasten your first solution(icon: 'fa fa-home') not worked unfortunately.

i want to use ionicons and fontawesome icons in menu-items... any solutions?!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fabltd picture fabltd  路  3Comments

queirozfcom picture queirozfcom  路  4Comments

PatrickHuetter picture PatrickHuetter  路  3Comments

burtonator picture burtonator  路  3Comments

yanyim picture yanyim  路  3Comments