I have an object defined as:
{ "IP-Address":"1.1.1.1", "name":"User1" }
in HTML
{{data.IP-Address}}
It shows an error The righthand side of arithmetic operator must be type 'any'
.
Because of Hyphen(-).
How can I resolve that?
I have an object defined as:
{ "IP-Address":"1.1.1.1", "name":"User1" }
in HTML
{{data.IP-Address}}
It shows an error The righthand side of arithmetic operator must be type 'any'
.
Because of Hyphen(-).
How can I resolve that?
Try with
{{data['IP-Address']}}
But I'd also suggest to manage more simple property names so you may use the safe navigation operator in case it could be useful on your app.
So you could do this
{{data?.ipAddress}}
and prevent possible error
TypeError: Cannot read property 'name' of null.
in case you're rendering when your object is still null or undefined.