I got this error message “ERROR Error [NullInjectorError]: R3InjectorError(Environment Injector)[_HttpClient -> _HttpClient]:
NullInjectorError: No provider for _HttpClient!” while trying to upload and save gifs through backend, nd there are some settings that I get from the backend of my application.
There is my app.module.ts
// app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { AppRoutingModule } from './app-routing.module';
import { RootComponent } from './root.component'; // Import RootComponent
import { GifDetailComponent } from '../gif/gif-detail.component'; // Import GifDetailComponent
import { FormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import { UploadComponent } from '../Upload/upload.component'; // Import UploadComponent
import { UploadModule } from '../Upload/upload.module'; // Import UploadModule
@NgModule({
declarations: [
RootComponent, // Declare RootComponent
GifDetailComponent,
],
imports: [
BrowserModule,
CommonModule,
AppRoutingModule,
RouterModule,
FormsModule,
HttpClientModule,
UploadModule,
],
providers: [],
bootstrap: [ RootComponent ] // Bootstrap RootComponent
})
export class AppModule { }
Upload.module.ts
// upload.module.ts
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms'; // Import FormsModule
import { UploadComponent } from './upload.component';
@NgModule({
declarations: [UploadComponent],
imports: [
CommonModule,
FormsModule, // Use FormsModule instead of ReactiveFormsModule
],
exports: [UploadComponent]
})
export class UploadModule { }
Any ideas what should i do?
There is a my github link : https://github.com/BekaEn/GifApp