I am querying our mongoDB API endpoint in order to obtain the value that represents the total number of records. If I try that API endpoint call directly in Postman, I get the number "1227" returned (a number, not a string). Now I am trying to get that value rendered to the view in my Angular app. I am using an observable to get the value. In my service I have this:
.map((response: Response) => response.json())
const counts = this.staffService.getStaffCount()
.subscribe(resRecordsData => this.records = resRecordsData,
responseRecordsError => this.errorMsg = responseRecordsError);
EXCEPTION: Error trying to diff '1227'
counts is a
Subscription object, not a
number, which is what
The result from the API (via the observable) is stored right now in
this.records, which is what you should put into the string interpolation in your template.
If that doesn't work, you'll need to inspect
resRecordsData in your browser's debugger and see how exactly the JSON result is formatted.