1
我有以下用例:'我在控制器的動作處理程序中創建資源'項目',之後我想轉換到新創建的route
'。我的意圖看起來是這樣的:如何獲取新創建的記錄的引用?
createNewProject: function() {
this.store.createRecord('project', {
title: this.get('title'),
description: this.get('description'),
full_description: this.get('full_description')
}).then((project) => {
this.transitionToRoute('projects.show', project);
});
}
,但它不喜歡的工作,因爲createRecord
沒有返回promise
據我知道,也許還有周圍的一些工作?
謝謝你的幫助。
繼續你所說的關於保存記錄的服務器,你的意思是這樣的'''project.save(),然後((項目)= > { this.transitionToRoute('projects.show',project); });''' – SuperManEver