问题描述:

I have the fiddle here: http://jsfiddle.net/kaihendry/NQKvy/414/

I've only got as far as

{{#each item in model.THREAD}}

<li>{{item}}</li>

{{/each}}

I want to be able iterate through the THREAD array of http://imap2json.dabase.com/mail.json and then pull values from the top-level json[{{item}}].Header.Subject out. So I can output like:

  • 1,2,3,4 Movie
  • 5 Dentist

I'm not sure what JSON object the returned JSON is bound to or debug. Any tips would be great.

网友答案:

Since the data isn't a real array, you need to reformat the data in order to be able to use it as an array in handlebars. You can't do fancy logic like you've proposed above, the data should be formatted beforehand (the controller is perfect for this, or the entire model should be reformatted before applying it to the controller).

http://emberjs.jsbin.com/aZUBUfEQ/1/edit

网友答案:

Here's another variant: reformatting the data before applying it to the controller via the setupController hook. http://jsfiddle.net/ahx_/NQKvy/419/

相关阅读:
Top