我有一个场景,在客户端上操作的数据以不同于服务器上表示的方式呈现和交互.
请考虑event从服务器返回的以下资源.
{
"id": 123,
"start_at": 1331336004906,
"end_at": 1331337704906
}
Run Code Online (Sandbox Code Playgroud)
以下模板用于编辑:
<form>
<!-- Notice how date and time are separated in the interface -->
<input type="text" name="start_date" value="{{start_date}}" />
<input type="text" name="start_time" value="{{start_time}}" />
<!-- Instead of asking for an end date/time, we ask for the duration -->
<input type="text" name="duration" value="{{duration}}" />
<input type="submit" />
</form>
Run Code Online (Sandbox Code Playgroud)
我怎么会去治疗start_date,start_time以及duration在我的骨干模型属性,而不将它们发送到服务器?我应该修改.toJSON()吗?