Here is the current structure of my class:
export class Patient {
constructor(public id: number, public name: string, public location: string, public bedId: number, public severity: string,
public trajectory: number, public vitalSigns: [GraphData[]], public latestReading: GraphData[]) {
}
public get combinedVSData(): Array<GraphData> {
let combinedVitalSigns: GraphData[] = [];
for (let data of this.vitalSigns) {
combinedVitalSigns.push(data[0]);
}
return combinedVitalSigns;
}
}
When attempting to call patient.combinedVSData
, it returns undefined
. I have tried returning a string instead with no success. Additionally, when adding console.log statements within the method, nothing is logged in the console, indicating that the method is not being called at all. What am I missing here?
The method is being called in one of my templates like this:
[results]="patientService.patientLevel3.combinedVSData"
It is also being called in one of my components' classes for testing purposes:
onDrop(event: any){
let movedPatient: Patient = JSON.parse(event.dataTransfer.getData("patient"));
let from = parseInt(event.dataTransfer.getData("from"));
console.log(movedPatient.combinedVSData);
this.patientService.patientLevel3 = movedPatient;
this.patientService.removePatient(from, movedPatient.id);
}
}
In both cases, the result is returned as undefined.
UPDATE: Further investigation has revealed that the reason why combinedVSData is not present on the object is due to it being lost during the conversion to JSON. Unfortunately, I am unsure of what steps can be taken to address this issue.