Hello I am trying to list a table with the ResumenService service but I get the following error
Error: Uncaught (in promise): NullInjectorError: R3InjectorError(GestionGeneralModule)[NgxsFeatureModule -> GestionGeneralSolState -> ResumenService -> ResumenService -> ResumenService -> ResumenService -> ResumenService]:
NullInjectorError: No provider for ResumenService: NullInjectorError: R3InjectorError(GestionGeneralModule)[NgxsFeatureModule -> GestionGeneralSolState -> ResumenService -> ResumenService -> ResumenService -> ResumenService -> ResumenService]:
NullInjectorError: No provider for ResumenService!
general.module.ts
import { HttpClientModule } from '@angular/common/http';
import { NgModule } from '@angular/core';
import { GeneralRoutingModule } from './general-routing.module';
import { GeneralService } from './services/general.service';
import { ResumenService } from './services/resumen.service';
@NgModule({
declarations: [],
imports: [
GeneralRoutingModule,
HttpClientModule
],
providers: [
GeneralService,
ResumenService,
]
})
export class GeneralModule { }
resumen.service.ts
import { HttpClient } from "@angular/common/http";
import { Injectable } from "@angular/core";
import { ConvertObjectToGetParams, IDataGridPageRequest } from "shared";
import { CORE_FUNCTIONS, IPaginationResponse, IServerResponse } from '@app/core';
import { environment } from "src/environments/environment";
@Injectable()
export class ResumenService {
private url = `${environment.baseUrlAPI}/api/resumen`;
constructor(
private http: HttpClient
) { }
ListarSolDocumentosControl = (idEvento: number) => {
const params = ConvertObjectToGetParams({ idEvento });
return this.http.get<IServerResponse<any[]>>(
`${this.url}/SolDocumentosControl`, { params }
);
};
guardarResumen = (idEvento: number, data: any, archivo: any) => {
const formData = CORE_FUNCTIONS.jsonToFormData({
...data,
archivo
});
return this.http.post<IServerResponse<any[]>>(
`${this.url}/DocumentosControl/${idEvento}`, formData, { headers: { 'Content-Type': 'Upload-File' } }
);
}
}
You are using ResumenService
into GestionGeneralSolState in GestionGeneralModule, but you only provide this service in GeneralModule. Please double check in GestionGeneralModule whether you have declared ResumenService or not
In ResumenService replace your @Injectable
for this:
@Injectable({
providedIn: 'root' // It will inject this provider at the root level of the application so it can be accessed anywhere.
})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.