Search code examples
angularangular2-routing

No provider for InjectionToken Global Config! error


After updating from angular 11 to 13 all my child routes became broken and i am getting this error

ERROR NullInjectorError: R3InjectorError(ArchViewModule)[InjectionToken Global Config -> InjectionToken Global Config -> InjectionToken Global Config -> InjectionToken Global Config -> InjectionToken Global Config -> InjectionToken Global Config]: 
  NullInjectorError: No provider for InjectionToken Global Config!
    at NullInjector.get (core.mjs:11105)
    at R3Injector.get (core.mjs:11272)
    at R3Injector.get (core.mjs:11272)
    at R3Injector.get (core.mjs:11272)
    at NgModuleRef.get (core.mjs:21800)
    at R3Injector.get (core.mjs:11272)
    at NgModuleRef.get (core.mjs:21800)
    at R3Injector.get (core.mjs:11272)
    at NgModuleRef.get (core.mjs:21800)
    at R3Injector.get (core.mjs:11272)

What is Global Config InjectionToken? Did't find any info about it or how it is provided to any angular app


Solution

  • I just had the same problem (after updating Angular from 11 to 13).

    In my case the error was:

    ERROR NullInjectorError: R3InjectorError(n)[InjectionToken Global Config -> InjectionToken Global Config -> InjectionToken Global Config]: 
    NullInjectorError: No provider for InjectionToken Global Config!
    at SC.get (main.078853b013d2848c.js:1:61264)
    at BF.get (main.078853b013d2848c.js:1:62617)
    at BF.get (main.078853b013d2848c.js:1:62617)
    at BF.get (main.078853b013d2848c.js:1:62617)
    at Ew.get (main.078853b013d2848c.js:1:90367)
    at Object.get (main.078853b013d2848c.js:1:87205)
    at Nv (main.078853b013d2848c.js:1:29111)
    at Bv (main.078853b013d2848c.js:1:29902)
    at f (main.078853b013d2848c.js:1:69189)
    at Xl.n.ɵfac [as factory] (main.078853b013d2848c.js:1:744197)
    

    I've found out that the problem was related to a library I am using in my Angular project (which is Anguar Material Design Progress Buttons).

    This library has to be imported as follows (inside the AppModule):

    import { MatProgressButtonsModule } from 'mat-progress-buttons';
    
    @NgModule({
      declarations: [AppComponent, ...],
      imports: [MatProgressButtonsModule.forRoot(), ...],  
      bootstrap: [AppComponent]
    })
    export class AppModule {
    }
    

    but i was missing the forRoot() call for MatProgressButtonsModule (which was not necessary before updating Angular: it wasn't present and the App always worked perfectly fine).

    Probably your problem is of the same nature: check that all the libraries you're using are imported in a correct way inside the AppModule, calling forRoot() when required.