Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ionicons disappear when using lazy loaded pages #526

Closed
frostyandy2k opened this issue Mar 7, 2018 · 1 comment
Closed

Ionicons disappear when using lazy loaded pages #526

frostyandy2k opened this issue Mar 7, 2018 · 1 comment

Comments

@frostyandy2k
Copy link

frostyandy2k commented Mar 7, 2018

After changing my pages to be lazy loaded (via @IonicPage and using modules) all ionicons dissapeared. When declaring the components directly in app.module.ts, everything works fine.

I did find a workaround, but it's pretty cumbersome and I still think this is either a bug or I did not know how to import the proper module or didn't create the structure as it was supposed to.

Module for the main page (HomePage):

import { NgModule } from "@angular/core";
import { IonicPageModule } from "ionic-angular";
import { HomePage } from "./home";
import { ComponentsModule } from "../../components/components.module";

@NgModule({
  declarations: [HomePage],
  imports: [IonicPageModule.forChild(HomePage), ComponentsModule],
  bootstrap: [HomePage]
})
export class HomePageModule {}

As you can see, no icon is shown and the the css content is empty.

image

Detail view of the button that should have an icon.
image

This is how it should look like:
image

image

The code:

 <button [navPush]="'admin'" ion-button icon-end>
        Admin
        <ion-icon name="star"></ion-icon>
 </button>

If you try it out, you might need to clean up the build. I used the following:

rm -rf .sourcemaps/
rm -rf www/
ionic serve -l

Thanks in advance and thank you for this wonderful (yet pretty hard to learn) framework!

@frostyandy2k
Copy link
Author

Fixed, i did incorrectly use IonicModule.forRoot(AppHeaderComponent) instead of simply adding IonicModule.

https://stackoverflow.com/questions/49157486/ionicons-not-showing-anymore-when-switching-to-ionicpage-components/49159363#49159363

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant