AngularJS - Access JSON keys that have spaces

enter image description here

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

I tried:

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

bad luck. Thanks for any help.

+6
source share
2 answers

What about

 task['CAR ID'] 

No period is required between the task and the opening bracket.

+6
source

You do not need a point to access the value. Try:

 {{ task['CAR ID'] }} 
+11
source

All Articles