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

前端 未结 9 1233
一整个雨季
一整个雨季 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:21

    Add HttpClientModule in your app.module.ts and try, it will work so sure. for example

    import { HttpModule } from '@angular/http
    
    0 讨论(0)
  • 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 { }
    
    0 讨论(0)
  • 2021-02-03 18:22

    import the HttpClientModule in your app.module.ts

    import {HttpClientModule} from '@angular/common/http';
    
    ...
    @NgModule({
    ...
      imports: [
        //other content,
        HttpClientModule
      ]
    })
    
    
    0 讨论(0)
提交回复
热议问题