5

我目前处于需要删除 ember js 选择框中使用的 metamorph 标签的情况。我使用了一个 JS 插件,它将我的选择框变成了我使用 css 自定义的样式选择框。

我目前在我的视图中有这个 ember js 选择框。

<script type="text/x-handlebars" data-template-name="opportunities">
{{view Ember.Select 
             contentBinding="controller.filter" 
             optionLabelPath="content.metacode"  
             optionValuePath="content.description" 
             class="mydds opportunitylistcategory"}}
</script>

我只需要一种删除变质代码的方法,但是对于 ember 选择框仍然启用绑定等...我已经阅读了有关使用可排序的 jquery 删除变质数据的信息,但这对我没有帮助。提前致谢!

4

1 回答 1

4

解决此问题的最佳方法是使用 Ember.CollectionView。

我用一个简单的无序列表(<ul><li>)遇到了这个问题。

这是一个演示如何做到这一点的答案https://stackoverflow.com/a/11749736/701368


编辑

最初的答案是针对 1.0 之前的 Ember 版本。

在处理较新版本的 Ember.js 时,我建议使用{{each}}带有属性的助手。itemViewClass您可以在此处找到文档:http: //emberjs.com/api/classes/Ember.Handlebars.helpers.html#toc_specifying-a-view-class-for-items

所以不要使用块级助手;你想使用{{each}}而不是{{#each}}.

于 2012-12-20T18:47:34.137 回答