Hayhan
Hayhan

Reputation: 13

ERROR : StaticInjectorError(AppModule)[global]: StaticInjectorError(Platform: core)[global]: NullInjectorError: No provider for global

I open my ionic project but nothing dispay in browser. I get error like My Error

this my code in app.module.ts

import { HttpClientModule } from "@angular/common/http";
import { HttpModule } from '@angular/http';
imports: [
  HttpClientModule,
  HttpModule ,
 ],
providers: [
  Clipboard,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
 ],
bootstrap: [AppComponent]
  })

Upvotes: 1

Views: 1124

Answers (1)

pk_teckie
pk_teckie

Reputation: 157

There are two possible reasons 1. If you are using HttpClient in your service you need to import HttpClientModule in your module file and mention it in the imports array.

import { HttpClientModule } from '@angular/common/http';

2) If you are using normal Http in your services you need to import HttpModule in your module file and mention it in the imports array.

import { HttpModule } from '@angular/http'

Upvotes: 1

Related Questions