好的,我对Ember很新,所以这可能是一个非常“noob”的问题。 我有一个已填充的模型,然后我调用save()。这会通过RESTAdapter将JSON数据发送到我的数据库。
我的数据库将记录保存为原始JSON,就像它接收客户端一样,除了它添加一个ID然后返回相同的模型。
在Chrome中,我可以看到请求已成功返回并返回,但我一直在控制台中收到此错误消息,而新创建的模型仍然“脏”。
ember.debug.js:19154 Error: Ember Data Request POST http://localhost:9991/v1/resources/troubleTickets returned a 0
Payload (Empty Content-Type)
at new Error (native)
at Error.EmberError (http://localhost:4200/assets/vendor.js:29610:21)
at Error.AdapterError (http://localhost:4200/assets/vendor.js:83234:16)
at Class.handleResponse (http://localhost:4200/assets/vendor.js:84513:14)
at ajaxError (http://localhost:4200/assets/vendor.js:85011:25)
at Class.hash.error (http://localhost:4200/assets/vendor.js:84585:23)
at fire (http://localhost:4200/assets/vendor.js:3617:31)
at Object.fireWith [as rejectWith] (http://localhost:4200/assets/vendor.js:3747:7)
at done (http://localhost:4200/assets/vendor.js:9556:14)
at XMLHttpRequest.<anonymous> (http://localhost:4200/assets/vendor.js:9788:10)
以下是发送到服务器的JSON记录的样子,并且返回的JSON完全匹配,除了添加了“id”属性:
{
"data":{
"attributes":{
"synopsis":"SYNOPSIS",
"description":"Ea eaque iusto veritatis nihil nisi incidunt, doloribus quia eum quae recusandae. Ipsum.",
"severity":null,
"priority":null,
"network":null,
"date-submitted":"2016-10-20T17:31:41.691Z",
"date-resolved":null,
"date-verified":null,
"sme":null,
"resolution":null,
"resolution-desc":null,
"current-status":"New",
"date-last-contact":null,
"orig-phone":"+612-75-8202261",
"orig-address":null,
"orig-first-name":"Kameko",
"orig-last-name":"Crane",
"orig-email":"sihoregew@yahoo.com",
"sub-first-name":"Noble",
"sub-last-name":"Booth",
"sub-phone":"+685-74-6686467",
"sub-email":"tiran@gmail.com"
},
"type":"trouble-tickets"
}
}
我在这里缺少什么? BTW ......我正在使用Ember 2.8.0