こんにちは皆さん私はモデルを持っていますCurrency
。フィールドname:string
、がありますdefault:boolean
。私のデータベースでは、デフォルト値を持つことができるレコードは 1 つだけで、このレコードを選択タグで選択したいと考えています。
例:
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());
収入.ハンドルバー
// Some output with Incomes records
{{view Ember.Select
contentBinding="controller.currencies"
optionLabelPath="content.name"
optionValuePath="content.id"}}