agon024 agon024 - 4 months ago 7
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

How about

task['CAR ID']

No period needed between task and the opening bracket.