Hello,
I have the following error :
ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[Tab1Page -> EventProvider]: **
** StaticInjectorError(Platform: core)[Tab1Page -> EventProvider]: **
** NullInjectorError: No provider for EventProvider!
Error: StaticInjectorError(AppModule)[Tab1Page -> EventProvider]: **
** StaticInjectorError(Platform: core)[Tab1Page -> EventProvider]: **
** NullInjectorError: No provider for EventProvider!
This is my code in tab1
this.event.loadEventsByUser(2)
.then((res:Event)=>
{
this.EventsLoad = res;
})
.catch(err => console.log(err));
And this is my code in EventProvider.ts :
loadEventsByUser(userid) {
return new Promise((resolve, reject) => {
console.log("this.userid = " + this.UserId);
this.http.api().get(‘Events/GetEventsByUserId’, { search: { userid: userid } })
.subscribe((data: any) => {
console.log("Data = " + data)
resolve(data);
})
});
}
And this is my code in httpclient.ts
get(url: string, options?: RequestOptionsArgs): Observable<Response> {
return from(this.setHeaders(options)).pipe(mergeMap(options => super.post(url, options)));
}
Can anyone help me ? Where am’I Wrong ?
Tks for your help