1
votes

I use a RESTAdapter model to fill a Ember's select view with options.

The contentBinding is mapped the a property in the controller, where I use this.set('myProperty', model.find(someQuery)).

model.find(someQuery) with 1 result works perfect, but model.find(someQuery) with many results have a weird effect. The last object from the result is showed as many times as the length of the result.

{{view Ember.Select contentBinding="myProperty" optionValuePath="content.id" optionLabelPath="content.name" selectionBinding="selectedResult" prompt=" "}}

1

1 Answers

3
votes

Interesting. At first glance the code you included in your question looks fine. To debug:

1) Check to be sure the query results are what you expect.

content = model.find(someQuery); //with many results
// wait for results...
console.log(content.getEach('id')); //expect array of ids
console.log(content.getEach('name')); //expect array of names

2) examine contents of myProperty - from template:

{{#each myProperty}}
  <pre>{{id}}.{{name}}</pre>
{{/each}}

Expect template to output id/name for each option.