I am new to typescript. Basically I have a typescript GET function where I want to pass an ID to get that particular record back. I am getting this error on the return line. I researched this before posting here but could not get something close to my scenario. Help appreciated!
Error TS2349 Cannot invoke an expression whose type lacks a call signature.
private getRecordRequestUrl = 'http://localhost/Service/api/ReservationRequest/GetRequestById';
getRecordRequest(RequestId: number): Promise<ReservationModel[]> {
return this.http.get(this.getRecordRequestUrl(RequestId))
.toPromise()
.then(response => response.json().Data as ReservationModel[])
.catch(this.handleError);
}
getRecordRequestUrl
is a string. You're trying to call it inthis.getRecordRequestUrl()
. Exactly the kind of mistake TypeScript is there to warn you about, which it does. – deceze♦