ERROR Error: StaticInjectorError(AppModule)[UserformService -> HttpClient]:

前端 未结 9 1238
一整个雨季
一整个雨季 2021-02-03 17:55

While trying to add a PrimeNG table I broke my build here: https://github.com/BillyCharter87/Tech-O-Dex-UI/tree/BrokeIt

I recall updating my package.json fr

9条回答
  •  日久生厌
    2021-02-03 18:22

    Make sure you have imported HttpClientModule instead of adding HttpClient direcly to the list of providers.

    See https://angular.io/guide/http#setup for more info.

    The HttpClientModule actually provides HttpClient for you. See https://angular.io/api/common/http/HttpClientModule:

    Code sample:

    import { HttpClientModule, /* other http imports */ } from "@angular/common/http";
    
    @NgModule({
        // ...other declarations, providers, entryComponents, etc.
        imports: [
            HttpClientModule,
            // ...some other imports
        ],
    })
    export class AppModule { }
    

提交回复
热议问题