I have implemented a simple ionic application that has a page that calls a angular7-odooRpc service which you can find here angular7-odoo-jsonrpc , but i'm facing this error when i call the constructor of OdooRPCService
ERROR Error: Uncaught (in promise): NullInjectorError: StaticInjectorError(AppModule)[OdooRPCService -> HttpClient]: StaticInjectorError(Platform: core)[OdooRPCService -> HttpClient]: NullInjectorError: No provider for HttpClient! NullInjectorError: StaticInjectorError(AppModule)[OdooRPCService -> HttpClient]: StaticInjectorError(Platform: core)[OdooRPCService -> HttpClient]: NullInjectorError: No provider for HttpClient! at NullInjector.get (core.js:778) at resolveToken (core.js:2564) at tryResolveToken (core.js:2490) at StaticInjector.get (core.js:2353) at resolveToken (core.js:2564) at tryResolveToken (core.js:2490) at StaticInjector.get (core.js:2353) at resolveNgModuleDep (core.js:26403) at NgModuleRef_.get (core.js:27491) at resolveNgModuleDep (core.js:26403) at resolvePromise (zone-evergreen.js:797) at resolvePromise (zone-evergreen.js:754) at zone-evergreen.js:858 at ZoneDelegate.invokeTask (zone-evergreen.js:391) at Object.onInvokeTask (core.js:34182) at ZoneDelegate.invokeTask (zone-evergreen.js:390) at Zone.runTask (zone-evergreen.js:168) at drainMicroTaskQueue (zone-evergreen.js:559)
In my app module file i imported HttpClientModule and i added it to imports array inside @ngModule
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HttpClientModule } from '@angular/common/http';
import { OdooRPCService } from 'angular7-odoo-jsonrpc';
@NgModule({
declarations: [AppComponent],
entryComponents: [],
imports: [BrowserModule,
IonicModule.forRoot(),
AppRoutingModule,
FontAwesomeModule,
HttpClientModule
],
providers: [
StatusBar,
SplashScreen,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
OdooRPCService
],
bootstrap: [AppComponent]
})
export class AppModule { }
HttpClient
? Sometimes it can autosuggest ones from other packages likeselenium-webdriver\HttpClient
? The one you want isimport { HttpClient } from '@angular/common/http';
- rtpHarryhttpclient
and it came back with zero results, it doesn't exist in the OdooRPC... repo, so I assumed it must be somewhere else in your code? - rtpHarry@inject
and looked at the packages, but httpclient should have been inside common which was in the package.json, and i couldnt think of anything else to try - rtpHarry