0
你好家伙我有型号Currency
。我有字段name:string
,default:boolean
。在我的数据库中,只有一条记录可以有默认值,我希望在选择标签中选择这条记录。默认值在选择Ember js
实施例:
name: Eur default:false
name: USD default: true
name: RUR default: false
我想有:
<selected>
<option>Eur</option
<option selected=selected>USD</option
<option>RUR</option
</selected>
Route.js
EmberMoney.IncomesRoute = Ember.Route.extend
model: ->
EmberMoney.Income.find()
setupController: (controller) ->
controller.set('currencies', EmberMoney.Currency.find());
incomes.handlebars
// Some output with Incomes records
{{view Ember.Select
contentBinding="controller.currencies"
optionLabelPath="content.name"
optionValuePath="content.id"}}
感谢您的帮助但我不明白。在什么文件中最好放置这个扩展选择?我把它放在视图文件中。可以吗?这是呈现此选择的正确方法?当我在我的第一篇文章中呈现?这对我不起作用。对不起,愚蠢的问题。 – EJIqpEP7 2013-03-26 05:20:32