Znowman Znowman - 1 year ago 91
JSON Question

Angularjs syntax error

Trying to output data from an API:


Gives an error:
Syntax Error: Token '.3' is an unexpected token at column 19 of the expression [forecast.list.rain.3h] starting at [.3h].
saying that .3 is the error, integers not allowed in {{....}}?
This seems problematic when the data is stored like this:


Answer Source

Well you can't reference this property with dot-notation since a valid identifier may not start with a number. Use {{forecast.list.rain['3h']}} instead.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download