isNew

  • function
can.Model.prototype.isNew  

Check if a Model has yet to be saved on the server.

model.isNew()

Returns

{Boolean}

Whether an instance has been saved on the server. (This is determined by whether id has a value set yet.)

isNew() returns if the instance is has been created on the server. This is essentially if the id property is null or undefined.

new Recipe({id: 1}).isNew() //-> false