i have an api as the following:
getUserTanks(userID: string): Observable<Tank[]> {
return this.http.get(`${this.ApiUrl}/tank/read_user_tanks.php?userID=${userID}`)
.map(res => <Tank[]>res.json());
}
i am trying to return these parameters from the API:
Height, Length and Width which are Keys that hold values in the JSON Object see below:
the API is working and im able to return values and bind them like so {{tank.Height}} in the HTML but i need to run functions and calculations based on the returned values.
[{"ID":"27","Name":"PhilsTank","Width":"12.0000","Length":null,"Height":"12.0000","Volume":"0.0000","GlassThickness":"12.0000","TypeID":"1","Sump":"12","UserID":"1","Active":"1"},{"ID":"32","Name":"Lousias tank","Width":"123456.0000","Length":1000.0000,"Height":"234567.0000","Volume":"0.0000","GlassThickness":"12342.0000","TypeID":"1","Sump":"123","UserID":"1","Active":"1"}]
I want to acheive something like the code below excuse syntax as this is on the fly:
CalcVolume(){
let Tankheight = this.tanks.Height;
let TankWidth = this.tanks.Width;
Let TankLength = this.tanks.Length;let tankVolume = this.TankHeightthis.TankLengththis.TankWidth/100000;
console.log(tankVolume,“litres”)
}
how do i access the Keys and retrieve their values?