Created
June 6, 2012 00:53
-
-
Save haric/2879185 to your computer and use it in GitHub Desktop.
Ember clone view
This file contains hidden or 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
| function cloneFromView(obj) { | |
| if (null == obj || "object" != typeof obj) return obj; | |
| var copy = Ember.View.create({ | |
| templateName: obj.templateName | |
| }); | |
| for (var attr in obj) { | |
| if (obj.hasOwnProperty(attr)) copy[attr] = obj[attr]; | |
| } | |
| return copy; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment