Hi everybody,
I started developing a widget from 1 week and I have a big problem with it.
I'm not able to invoke a REST-API in POST, I have tried to with the method in typescript
constructor(private http: HttpClient) {}
, but the browser told me that it's cannot read property 'post' of undefined, I add there an image that shows the error

I add there my code there to explain better my problem, the class
ConfigService
is the class that creates the client, it's this:
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { HttpHeaders } from '@angular/common/http';
import { Obj9003 } from './9003';
@Injectable()
export class ConfigService {
constructor(private http: HttpClient) {}
public createArticle(article: Article , string: url): Observable
{
return this.http.post(this.url, this.article);
}
}
The class that calls the structure is this the widget.ts
In the top I added this part:
import { CommonModule } from "@angular/common";
import { AfterViewInit, Component, Input, NgModule } from "@angular/core";
import { BrowserModule } from '@angular/platform-browser';
import { HttpClientModule } from '@angular/common/http';
import { SohoListViewModule } from "@infor/sohoxi-angular";
import { Obj9003 } from "./9003";
import { ConfigService } from "./service";
import {
IWidgetComponent,
IWidgetContext2,
IWidgetInstance2,
IWidgetSettingMetadata,
IWidgetSettingsArg,
Log,
WidgetSettingsType,
} from "lime";
And the point where a call the class to consume the request is this:
var article: Obj9003 = new Obj9003();
var url: string = "<a href="http://localhost:5824/restPost">localhost:5824/restPost";</a>
var app: Observable
;
var service = new ConfigService();
app = service.createArticle(article , url);
the class Obj9003
is this:
export class Obj9003 {
data: string = "1000";
valA: string = "2000";
valB: string = "3000";
}
Can somebody help me please to understand where I wrong? Thank you so much.
Have a nice day.