Skip to content

bug: Angular 12 not compatible with Ionic 6.1.9 #25448

@blackholegalaxy

Description

@blackholegalaxy

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x
  • Nightly

Current Behavior

While upgrading a fully functional project using router and ionic 5 from angular 11 and ionic 5 to angular 12 and ionic 6, following error occurs.

Please note keeping ionic 5 along with angular 12 doesn't produce problem. But we need some ionic 6 features for our project.

ERROR Error: Uncaught (in promise): TypeError: componentFactory.create is not a function
TypeError: componentFactory.create is not a function
    at ViewContainerRef.createComponent (core.js:23191:1)
    at IonRouterOutlet.activateWith (ionic-angular.js:3437:57)
    at ActivateRoutes.activateRoutes (router.js:2163:1)
    at router.js:2114:1
    at Array.forEach (<anonymous>)
    at ActivateRoutes.activateChildRoutes (router.js:2113:1)
    at ActivateRoutes.activate (router.js:2034:1)
    at MapSubscriber.project (router.js:2019:1)
    at MapSubscriber._next (map.js:29:1)
    at MapSubscriber.next (Subscriber.js:49:1)
    at resolvePromise (zone.js:1262:1)
    at resolvePromise (zone.js:1216:1)
    at zone.js:1329:1
    at push.6026._ZoneDelegate.invokeTask (zone.js:443:1)
    at Object.onInvokeTask (core.js:28679:1)
    at push.6026._ZoneDelegate.invokeTask (zone.js:442:1)
    at push.6026.Zone.runTask (zone.js:214:1)
    at drainMicroTaskQueue (zone.js:632:1)

Expected Behavior

No error while upgrading to angular 12 on a project using routing and ionic 6 since packages are indicated to be compatible.

Steps to Reproduce

ionic start ionic6 tabs --cordova --no-deps

Delete Tabs module and point to Explore container component as the only route, adding component in app.module.

Change angular 14 for angular 12 which is stated to be compatible with on ionic page.

Error occurs.

Code Reproduction URL

https://github.com/blackholegalaxy/repro-ionic-bug

Ionic Info

$ ionic info

Ionic:

Ionic CLI : 6.19.1 (C:\Users\X\AppData\Roaming\npm\node_modules@ionic\cli)
Ionic Framework : @ionic/angular 6.1.9
@angular-devkit/build-angular : 12.2.17
@angular-devkit/schematics : 13.3.7
@angular/cli : 12.2.17
@ionic/angular-toolkit : 6.1.0

Cordova:

Cordova CLI : 11.0.0
Cordova Platforms : not available
Cordova Plugins : not available

Utility:

cordova-res : not installed globally
native-run : not installed globally

System:

NodeJS : v16.13.2 (C:\Program Files\nodejs\node.exe)
npm : 8.1.2
OS : Windows 10

Additional Information

The error points to ionic-angular file which tries to land in angular 14 else block.

image

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions