角度jsでng-repeatを使用してjsonファイルから値を表示しようとしていますが、それを行うことができません。ng-repeatを使って角度jのキー値にアクセスする方法は?
これは私がしようとしている私のコードです:
<div ng-repeat = "x in myWelcome.definition">
{{x.attributes[0].children[0].node_id}}
<hr>
</div>
を私はこれを試してみました、それが働いている:
<!-- first attributes start -->
<div ng-repeat = "x in myWelcome.definition.attributes">
{{x.rm_attribute_name}}<hr>
<div ng-repeat="a in x.children">
<div ng-if ="a.attributes">
a: {{a.attributes[0].rm_attribute_name}}
<div ng-if= "a.attributes[0].children">
chld
</div>
</div>
</div>
</div>
<!-- second attributes end -->
私はこの行は{{働いているかを理解しようとしています。属性{0} .rm_attribute_name}}これは{{a.attributes 1 .rm_attribute_name}}のように動作しませんなぜこれは混乱します。 0とインデックスを使用しているときに、どのようにすべての結果を表示していますか? そして、私のJSONファイルはplunkerにここにある: Plunker link of json and code
それでは、どのように私はここにこのコードをngのリピートを使用して、ここで繰り返すことができます:
{{myWelcome.definition.attributes[0]}}
はNGを使用して、私は私の見解では、これを表示することができますどのように取り組んでいます-repeat ng-repeatを使ってすべての属性と子を表示する必要があります。
<div ng-repeat = "(key,value) in myWelcome.definition.attributes">
Key:{{key}} and value :{{value}}
<hr>
</div>
ORあなたはこれを試すことができます:
[好きですか](http://stackoverflow.com/questions/15127834/how-can-i-iterate-over-the-keys-value-in-ng-repeat-in-angular)を意味しますか? '(key。x)in myWelcome.definition' –
キーと値知っているのは、ng-repeatだけを使って行うことができます。定義は私が子を持っているなどです。 –
@Codingisgreat、http:// jsfiddle.net/Lvc0u55v/5529/ –