I have an Angular 8 application with the following code:
export class ResponseModel<T> {
status: string;
message: string;
data: T;
isSuccess(): boolean {
return '00' === status;
}
}
and the following...
this.httpClient.get(myUrl)
.subscribe((response: ResponseModel<any>) => {
if (response.isSuccess()) {
// Rest of the code
}
}
The response: ResponseModel
object serializes well from the http
result but response.isSuccess()
throws an error:
TypeError: response.isSuccess() is not a function
What could be wrong with my code above?