Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4829

{{get}} helper with dynamic key not working

$
0
0

@haggis wrote:

In a component I have the following property:

values: {
  4: {
    'value': 5,
    'unit': 'km/h'
  },
  8: {
    'value': 7,
    'unit': 'db'
  }
},
indexes: [4, 8]

In it's template, I need to dynamically access this property. Until I updated my app to 2.4 the following has worked:

{{#each indexes as |index delta|}}
  index: {{index}}<br />
  value: {{get (get values index) "value"}}<br />
{{/each}}

Now the result is just:

index: 4
value: 
index: 8
value:

However, if I replace the dynamic index part with a static index, it works:

{{#each indexes as |index delta|}}
  index: {{index}}<br />
  value: {{get (get values "8") "value"}}<br />
{{/each}}


index: 4
value: 7
index: 8
value: 7

There's no error in JS console.

DEBUG: -------------------------------
DEBUG: Ember      : 2.4.3
DEBUG: Ember Data : 2.4.1
DEBUG: jQuery     : 1.12.2
DEBUG: -------------------------------

Any idea what's going wrong here?

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4829

Trending Articles