Question

I am working with a trading partner who sends me JSON with embedded spaces in the keys. For example

[{"BANK ID":89769876976,"Account Number":789698769876,"Account Type":"CHECKING","Balance":1187.65...

and I cannot find a way to access the keys using angular {{ }} expressions. Any clues?

Was it helpful?

Solution

You can just use the bracket notation (without the dot)

<div ng-repeat="acct in accounts">
  Bank Id: {{ acct['BANK ID'] }},
  Account Number: {{ acct['Account Number'] }}, 
  Type: {{ acct['Account Type'] }},
  Balance: {{ acct.Balance }}
</div>

Here is a Demo

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top