agon024 agon024 - 1 year ago 110
Javascript Question

angularJS - Accessing JSON keys that have spaces in them

enter image description here

Above is a picture of the JSON data being returned by the API. As you can see some of the JSON keys have two words with a space in between them. How can I access that in my angular app. This is coming in as an array BTW.

I have tried:

<li ng-repeat="task in mainTask.Tasks"> {{ task.['CAR ID'] }} </li>

with no luck. Thanks for any help.

Answer Source

How about

task['CAR ID']

No period needed between task and the opening bracket.

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