Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ember.js/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
View 使用RestaAdapter时,Ember的选择选项错误_View_Ember.js_Ember Data - Fatal编程技术网

View 使用RestaAdapter时,Ember的选择选项错误

View 使用RestaAdapter时,Ember的选择选项错误,view,ember.js,ember-data,View,Ember.js,Ember Data,我使用RESTAdapter模型用选项填充余烬的选择视图 contentBinding映射到控制器中的a属性,我在控制器中使用它 具有1个结果的model.findsomeQuery工作得非常完美,但具有许多结果的model.findsomeQuery会产生奇怪的效果。结果中的最后一个对象显示的次数与结果的长度相同 {{查看成员。选择contentBinding=myProperty选项ValuePath=content.id optionLabelPath=content.name selec

我使用RESTAdapter模型用选项填充余烬的选择视图

contentBinding映射到控制器中的a属性,我在控制器中使用它

具有1个结果的model.findsomeQuery工作得非常完美,但具有许多结果的model.findsomeQuery会产生奇怪的效果。结果中的最后一个对象显示的次数与结果的长度相同

{{查看成员。选择contentBinding=myProperty选项ValuePath=content.id optionLabelPath=content.name selectionBinding=selectedResult
prompt=}

有趣。乍一看,问题中包含的代码看起来不错。要调试:

1检查以确保查询结果符合您的预期

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检查myProperty的内容-从模板:

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

希望模板为每个选项输出id/名称。

谢谢你,迈克。身份证是同一个doh!!对于数组的所有对象。