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
Can't bootstrap a hybrid application in Angular 8 due to commonservices being undefined #516
Comments
Suffering from the same problem, did you find a workaround? |
I added an ajs config as follows and that seems to get it going: |
Have the same issue using AngularJS/Angular 9.1 Hybrid. |
Did you try to remove the dependency |
For anyone experiencing a similar issue, please make sure you don't have multiple copies of any of the You can determine if you have multiple copies using (yarn): |
closing. if this is still a problem, reopen. |
I am trying to get a hybrid router application running using the latest Angular 8 (8.2.9) and am running into issue both in my own test app and in an upgraded version of the sample hybrid app that is running here
https://stackblitz.com/github/ui-router/sample-app-angular-hybrid/tree/angular-cli?file=package.json
When taking this code and upgrading all the dependencies to latest I end up getting this error during the angular bootstrap process
ERROR TypeError: Cannot read property 'when' of undefined
at new Resolvable (resolvable.js:43)
at Function.push../node_modules/@uirouter/core/lib-esm/resolve/resolvable.js.Resolvable.fromData (resolvable.js:109)
at uirouter-angular-hybrid.js:216
at Object.invoke (angular.js:5143)
at angular.js:4942
at forEach (angular.js:387)
at createInjector (angular.js:4942)
at doBootstrap (angular.js:1962)
at Object.bootstrap (angular.js:1983)
at bootstrap (static.js:73)
I have tracked this back to $q being undefined in this line of resolvable.js
this.promise = this.resolved ? services.$q.when(this.data) : undefined;
services is defined in coreservices.ts and services.$q is undefined. I have read through quite a few examples around setting up the hybrid router and given upgrading the existing sample gives me the same error I don't think I've done anything obviously wrong.
Below are the list of steps I did to get the example in stackblitz to compile after upgrading everything.
Removed @angular/http and core.js from the dependencies leaving the following
commented out core-js in polyfills.ts
updated tsconfig.json & tsconfig.app.json to module: esnext
fixed loadChildren in app.module.ts
commented out { provide: NgModuleFactoryLoader, useClass: SystemJsNgModuleLoader }
I'm not sure if this is a bug or a missing bit of configuration but any guidance would be helpful at this point.
A similar issue was reported back in Nov 2019 here with no resolution
https://angularquestions.com/2019/11/27/unhandled-promise-rejection-using-uirouter-angular-hybrid/
The text was updated successfully, but these errors were encountered: