Skip to content

Instantly share code, notes, and snippets.

@Colorfulstan
Created September 11, 2015 13:43
Show Gist options
  • Save Colorfulstan/a06f645d3ead498553dd to your computer and use it in GitHub Desktop.
Save Colorfulstan/a06f645d3ead498553dd to your computer and use it in GitHub Desktop.
Clone canJS model
can.Model.prototype.clone = function(){
var data = this.attr();
delete data[this.constructor.id];
return new this.constructor(data)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment