Skip to content
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

Error Inject AdalService with Angular 9 #141

Open
ectalactus opened this issue Mar 31, 2020 · 2 comments
Open

Error Inject AdalService with Angular 9 #141

ectalactus opened this issue Mar 31, 2020 · 2 comments

Comments

@ectalactus
Copy link

Hi Everybody,

I have update my application to Angular 9.1 with adal-angular4 4.0.12, And It's seem there is a problem when you want to inject AdalService in service or component constructor.

`ERROR Error: Uncaught (in promise): Error: This constructor is not compatible with Angular Dependency Injection because its dependency at index 0 of the parameter list is invalid.
This can happen if the dependency type is a primitive like a string or if an ancestor of this class is missing an Angular decorator.

Please check that 1) the type for the parameter at index 0 is correct and 2) the correct Angular decorators are defined for this class and its ancestors.
Error: This constructor is not compatible with Angular Dependency Injection because its dependency at index 0 of the parameter list is invalid.
This can happen if the dependency type is a primitive like a string or if an ancestor of this class is missing an Angular decorator.

Please check that 1) the type for the parameter at index 0 is correct and 2) the correct Angular decorators are defined for this class and its ancestors.
at ɵɵinvalidFactoryDep (core.js:965)
at Object.AdalService_Factory [as factory] (ɵfac.js? [sm]:1)
at R3Injector.hydrate (core.js:16865)
at R3Injector.get (core.js:16617)
at NgModuleRef$1.get (core.js:36024)
at Object.get (core.js:33773)
at getOrCreateInjectable (core.js:5805)
at Module.ɵɵdirectiveInject (core.js:20861)
at NodeInjectorFactory.LoginComponent_Factory [as factory] (login.component.ts:16)
at getNodeInjectable (core.js:5950)
at resolvePromise (zone-evergreen.js:798)
at resolvePromise (zone-evergreen.js:750)
at zone-evergreen.js:860
at ZoneDelegate.invokeTask (zone-evergreen.js:399)
at Object.onInvokeTask (core.js:41344)
at ZoneDelegate.invokeTask (zone-evergreen.js:398)
at Zone.runTask (zone-evergreen.js:167)
at drainMicroTaskQueue (zone-evergreen.js:569)`

In this trace you can see that the error is in login.component.ts, when a I remove AdalService injection, the execution failed on the next component/service which inject AdalService

Any idea?
Regards

@ectalactus
Copy link
Author

I have disable Ivy and it's work but it's not an option for the futur

@martinvillysson
Copy link

It looks a bit similar to this issue angular/angular#35788 and we were able to solve it with this fix: angular/angular#35788 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants