Error: No component factory found when using Angular lazy loading

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, and I’m having troubles :confused:

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) {
      return;
    }
    // First component should always be IonicApp
    route = route.firstChild;
    if (route && route.component === ShellComponent && route.firstChild) {
      while (route.firstChild) {
        route = route.firstChild;
      }

      this.navRoot = <Component>route.component;
    }
  }

and the corresponding part in my template:

  <ion-nav main [root]="navRoot" #content swipeBackEnabled="false"></ion-nav>

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 the same approach works fine if I use angular’s <router-outlet> component instead of <ion-nav> (but I don’t want to as animation cannot be used this way and it cause CSS issues).

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?

Hello,
I do not understand what you want to do (depends on my bad english), but the failure points to AboutComponent and nothing in your posted code depends to AboutComponent.

Maybe It helps, if you can post related code.

Best regards, anna-liebt