"Error: No component factory found" when using Angular lazy loading with Ionic navigation

تعرفه تبلیغات در سایت
عنوان عکس
عنوان عکس
عنوان عکس
عنوان عکس
عنوان عکس


یافته ها در جستجو

    امکانات وب

    آرشیو مطالب

    برچسب ها

    Vote count: 0

    I'm using Ionic with angular-cli (see https://github.com/ngx-rocket/starter-kit/tree/cordova/ionic), and I'm trying to use standard angular router lazy loading feature along with Ionic navigation, but it's not working nicely.

    This is how I tied angular router with Ionic's navigation system, calling this method on NavigationEnd events:

    private updateNav(route: ActivatedRoute) {
        if (!route || !route.firstChild) {
        // First component should always be IonicApp
        route = route.firstChild;
        if (route && route.component === ShellComponent && route.firstChild) {
          while (route.firstChild) {
            route = route.firstChild;
          this.navRoot = route.component;

    and the corresponding part in my template:


    It's working nicely, except when I'm trying to use lazy loaded component I'm having this error:

    Error: Uncaught (in promise): Error: No component factory found for AboutComponent. Did you add it to @NgModule.entryComponents?

    The component I'm trying to use is added to the entryComponents array of it's lazy loaded module, and it works fine if I use angular's component instead of , but I don't want to use this as a fix as animation cannot be used this way and it cause CSS issues with Ionic components.

    Obviously the Ionic navigation system was no made to work with angular router lazy loaded chunks but with @IonicPage modules, but I'm wondering if there was any way around to bridge the two systems as @IonicPage does not work with angular-cli?

    Any ideas?

    asked 52 secs ago

    نویسنده : استخدام کار بازدید : 3 تاريخ : دوشنبه 23 بهمن 1396 ساعت: 20:08
    برچسب‌ها :
    اخبار و رسانه هاهنر و ادبیاترایانه و اینترنتعلم و فن آوریتجارت و اقتصاداندیشه و مذهبفوتو بلاگوبلاگ و وبلاگ نویسیفرهنگ و تاریخجامعه و سیاستورزشسرگرمی و طنزشخصیخانواده و زندگیسفر و توریسمفارسی زبان در دیگر کشورها