문제

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?

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top