Closed ryan1509 closed 6 years ago
A little more information will be better. Can't help You with this information. Fill up the default error form :-)
Closing cause of not enough information. If You still have problem reopen it.
Hi,
I have the same issue when trying to inject NgxPermissionsService in providers when trying to bootstrap application using a standalone appComponent in angular 14
Here is the errors logs:
ERROR Error: Uncaught (in promise): NullInjectorError: R3InjectorError(Environment Injector)[AuthSecurityService -> AuthenticationService -> NgxPermissionsService -> InjectionToken USE_PERMISSIONS_STORE -> InjectionToken USE_PERMISSIONS_STORE]: NullInjectorError: No provider for InjectionToken USE_PERMISSIONS_STORE! NullInjectorError: R3InjectorError(Environment Injector)[AuthSecurityService -> AuthenticationService -> NgxPermissionsService -> InjectionToken USE_PERMISSIONS_STORE -> InjectionToken USE_PERMISSIONS_STORE]: NullInjectorError: No provider for InjectionToken USE_PERMISSIONS_STORE! at NullInjector.get (core.mjs:9091:27) at R3Injector.get (core.mjs:9258:33) at R3Injector.get (core.mjs:9258:33) at injectInjectorOnly (core.mjs:4870:33) at Module.ɵɵinject (core.mjs:4874:12) at Object.NgxPermissionsService_Factory [as factory] (ngx-permissions.mjs:137:1) at R3Injector.hydrate (core.mjs:9353:35) at R3Injector.get (core.mjs:9247:33) at injectInjectorOnly (core.mjs:4870:33) at Module.ɵɵinject (core.mjs:4874:12) at resolvePromise (zone.js:1211:31) at resolvePromise (zone.js:1165:17) at zone.js:1278:17 at _ZoneDelegate.invokeTask (zone.js:406:31) at Object.onInvokeTask (core.mjs:26502:33) at _ZoneDelegate.invokeTask (zone.js:405:60) at Zone.runTask (zone.js:178:47) at drainMicroTaskQueue (zone.js:585:35)
main.ts code:
` import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { NgxPermissionsService } from 'ngx-permissions';
bootstrapApplication(AppComponent, { providers: [ ... importProvidersFrom(BrowserAnimationsModule), ... NgxPermissionsService, AuthSecurityService, { provide: _JwtHelperService, useFactory: () => { return new _JwtHelperService(); } },
]
}); `
I found the solution
importProvidersFrom(NgxPermissionsModule.forRoot())
I found the solution
importProvidersFrom(NgxPermissionsModule.forRoot())
Hi, when I add that, I get this error:
Argument of type 'ModuleWithProviders<NgxPermissionsModule>' is not assignable to parameter of type 'Type<unknown>'. Type 'ModuleWithProviders<NgxPermissionsModule>' is missing the following properties from type 'Type<unknown>': apply, call, bind, prototype, and 5 more.
ERROR Error: Uncaught (in promise): Error: StaticInjectorError[InjectionToken USE_PERMISSIONS_STORE]: StaticInjectorError[InjectionToken USE_PERMISSIONS_STORE]: NullInjectorError: No provider for InjectionToken USE_PERMISSIONS_STORE! Error: StaticInjectorError[InjectionToken USE_PERMISSIONS_STORE]: StaticInjectorError[InjectionToken USE_PERMISSIONS_STORE]: NullInjectorError: No provider for InjectionToken USE_PERMISSIONS_STORE! at NullInjector.get (core.js:993) at resolveToken (core.js:1281) at tryResolveToken (core.js:1223) at StaticInjector.get (core.js:1094) at resolveToken (core.js:1281) at tryResolveToken (core.js:1223) at StaticInjector.get (core.js:1094) at resolveNgModuleDep (core.js:10878) at NgModuleRef.get (core.js:12110) at resolveDep (core.js:12608) at NullInjector.get (core.js:993) at resolveToken (core.js:1281) at tryResolveToken (core.js:1223) at StaticInjector.get (core.js:1094) at resolveToken (core.js:1281) at tryResolveToken (core.js:1223) at StaticInjector.get (core.js:1094) at resolveNgModuleDep (core.js:10878) at NgModuleRef.get (core.js:12110) at resolveDep (core.js:12608) at resolvePromise (zone.js:821) at resolvePromise (zone.js:785) at eval (zone.js:870) at ZoneDelegate.invokeTask (zone.js:421) at Object.onInvokeTask (core.js:4744) at ZoneDelegate.invokeTask (zone.js:420) at Zone.runTask (zone.js:188) at drainMicroTaskQueue (zone.js:594) at