Reactive form control on lazy loaded module throw error after upgrade angular 5
Hi,
i have upgrade my project angular 4.4.6 to angualr 5.1.0,
Reactive form control on lazy loaded module throw below error. If i comment the form controls, errror gone away.
If i call the same component in app main component it works.
Error:
core.js:1624 ERROR Error: Uncaught (in promise): Error: StaticInjectorError[InjectionToken CompositionEventMode]:
StaticInjectorError[InjectionToken CompositionEventMode]:
NullInjectorError: No provider for InjectionToken CompositionEventMode!
Error: StaticInjectorError[InjectionToken CompositionEventMode]:
StaticInjectorError[InjectionToken CompositionEventMode]:
NullInjectorError: No provider for InjectionToken CompositionEventMode!
at NullInjector.get (core.js:1190)
at resolveToken (core.js:1478)
at tryResolveToken (core.js:1420)
at StaticInjector.get (core.js:1291)
at resolveToken (core.js:1478)
at tryResolveToken (core.js:1420)
at StaticInjector.get (core.js:1291)
at resolveNgModuleDep (core.js:11080)
at NgModuleRef.get (core.js:12308)
at resolveNgModuleDep (core.js:11080)
at NullInjector.get (core.js:1190)
at resolveToken (core.js:1478)
at tryResolveToken (core.js:1420)
at StaticInjector.get (core.js:1291)
at resolveToken (core.js:1478)
at tryResolveToken (core.js:1420)
at StaticInjector.get (core.js:1291)
at resolveNgModuleDep (core.js:11080)
at NgModuleRef.get (core.js:12308)
at resolveNgModuleDep (core.js:11080)
at resolvePromise (zone.js:783)
at resolvePromise (zone.js:754)
at eval (zone.js:831)
at ZoneDelegate.invokeTask (zone.js:424)
at Object.onInvokeTask (core.js:4944)
at ZoneDelegate.invokeTask (zone.js:423)
at Zone.runTask (zone.js:191)
at drainMicroTaskQueue (zone.js:595)
at
I have import reactive from module in lazyloaded module also.
Package.json:
"@angular/animations": "5.1.0",
"@angular/common": "5.1.0",
"@angular/compiler": "5.1.0",
"@angular/core": "5.1.0",
"@angular/forms": "5.1.0",
"@angular/http": "5.1.0",
"@angular/platform-browser": "5.1.0",
"@angular/platform-browser-dynamic": "5.1.0",
"@angular/platform-server": "5.1.0",
"@angular/router": "5.1.0",
nguniversal/express-engine
"^5.0.0-beta.5",
nguniversal/module-map-ngfactory-loader
"^5.0.0-beta.5",
ngx-translate/core:
^8.0.0",
ngx-translate/http-loader:
"^2.0.0",
types/googlemaps: "
^3.30.0",
"angular-calendar": "0.15.0",
"angular-i18n": "^1.6.7",
"angular-tree-component": "3.7.3",
"angular2-multiselect-dropdown": "^1.3.6",
"bootstrap": "^4.0.0-beta.2",
"core-js": "^2.4.1",
"jquery": "^3.2.1",
"localize-router": "1.0.0-rc.3",
"localize-router-http-loader": "1.0.1",
"ng-pick-datetime": "^5.0.0-beta.11",
"ng2-nouislider": "^1.7.3",
"ng2-validation": "4.2.0",
"ngc": "^1.0.0",
"ngx-bootstrap": "^1.9.3",
"ngx-slick": "^0.1.3",
"nouislider": "^10.1.0",
"rxjs": "5.5.5",
"screenfull": "3.2.1",
"text-mask-addons": "3.5.1",
"ts-loader": "^3.2.0",
"zone.js": "0.8.14"
Dev: "@angular/cli": "1.5.5", "@angular/compiler-cli": "5.1.0", "@angular/language-service": "5.1.0", "ts-node": "~3.2.0", "tslint": "~5.3.2", "typescript": "2.4"
Thank you.
Same problem here. Angular 5.1.1. and cli 1.6.1. I did temporary fix by importing my previously lazy-loaded module directly in app.module.ts. Also adjusted routes.
Hopefully someone will come up with normal solution.
This seems like a bug but we'll need to look at a reproduction to find and fix the problem. Can you setup a minimal repro please?
You can read here why this is needed. A good way to make a minimal repro is to create a new app via ng new repro-app and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.
After spending some more time on investigation I found out that problem is raised by "localize-router" package. I fixed this problem by adding COMPOSITION_BUFFER_MODE to providers in my core module. https://angular.io/api/forms/COMPOSITION_BUFFER_MODE
For example: { provide: COMPOSITION_BUFFER_MODE, useValue: false }
Hi, Sorry for the late delay. I was preparing repo , its got delay due to work..
Thank you @RaivisB. COMPOSITION_BUFFER_MODE solve the problem. Thank you so much..
Hello,
Problem with COMPOSITION_BUFFER_MODE:
COMPOSITION_BUFFER_MODE worked for me before understand that some others modules doesn't seems to work.
How I fixed:
Change import order with LocalizeRouterModule before RouterModule fixed all my problems. Don't need COMPOSITION_BUFFER_MODE anymore.
Hope it can help.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.