我有些困惑如何在我的createRecord
动作中创建一个事件,当我在路由中返回3个模型时:
return RSVP.hash({
event: this.store.createRecord('event'),
hiws: this.store.findAll('hiw'),
tips: this.store.findAll('tip')
});
事件
是我想要创建的,但在hiws
和tips
中进行each
循环,因为一个事件
只有一个hiw
和一个tip
……就像这样:
<select class="tables__sidebar-select">
{{#each model.tips as |tip|}}
<option class="tables__sidebar-option">{{tip.name}}</option>
{{/each}}
<select>
同样的,对于hiws
也是如此。
我尝试这样做:
在我的createRecord
操作中,我有:
let hiws = this.get('model.hiws');
let tips = this.get('model.tips');
let notify = this.get('notify');
let event = this.get('store').createRecord('event', {
hiws: hiws,
tips: tips
});
event.save()
我正在尝试创建一个带有所有属性以及“hiw”和“tip”的事件,但是选定的“hiw”和“tip”无效。
编辑:
现在,我正在尝试使用以下内容:
{{view "select" content=models.tips.names value=models.event.tip}}
但是没有成功。