我想將模型的屬性設置爲不同的東西。當我保存模型時,Backbone發出POST請求而不是PUT請求。執行POST請求而不是PUT請求的骨幹
我在另一個Stackoverflow帖子上看到,Backbone使用模型的id來確定模型是否是新建的。當我console.log(model)
,模型有一個id屬性。當我console.log(model.id)
,它打印出未定義。如何當我做一個console.log(model)
,模型有一個id屬性,但當我做console.log(model.id)
時,我回來undefined?
Backbone使用哪種方式確定模型是否爲新模型?而且,我該如何解決這個問題?我正在使用backbone-tastypie。
這有幫助嗎? - http://stackoverflow.com/questions/7473057/save-on-existing-model-causes-post-instead-of-put – 2012-07-11 06:17:48