モデルをサーバーと同期しようとしています。残念ながら、モデルを設定url
しても、 url プロパティが指定されていません。rootUrl
言うまでもなく、このモデルで問題なく (GET) 実行できますが、POST を実行しようとすると、突然URLmodel.fetch()
が失われます。
>>> model = window.mod
ClientSchema { cid="c2", attributes={...}, _changing=false, more...}
>>> model.url
"http://localhost:8080/mp/add"
>>> model.urlRoot
"http://localhost:8080/mp/add"
>>> model.set({test:2})
ClientSchema { cid="c2", attributes={...}, _changing=false, more...}
>>> model.sync()
Error: A "url" property or function must be specified
urlError()vendor.js
Backbone.sync()vendor.js
.sync()vendor.js
throw new Error('A "url" property or function must be specified');
モデル
# coffeescript
# Chaplin.Model just extends Backbone.Model
module.exports = class ClientSchema extends Chaplin.Model
url: 'http://localhost:8080/mp/add'
urlRoot:'http://localhost:8080/mp/add'
モデル同期
>>> model.sync.toString()
"function () {
return Backbone.sync.apply(this, arguments);
}"