Created
September 11, 2015 13:43
-
-
Save Colorfulstan/a06f645d3ead498553dd to your computer and use it in GitHub Desktop.
Clone canJS model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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