Last active
December 1, 2015 19:24
-
-
Save thermokarst/8cbfefe93f5dcdaecbbd to your computer and use it in GitHub Desktop.
Array Copy
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
import Ember from 'ember'; | |
const { Controller, Object } = Ember; | |
const TestObject = Object.extend({ | |
property1: 'abc', | |
property2: [1], | |
}); | |
export default Controller.extend({ | |
appName:'Ember Twiddle', | |
original: TestObject.create({}), | |
}); |
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
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
// PASSED IN | |
myObject: null, | |
propertiesList: ['property1', 'property2'], | |
// Populated on init | |
property1: null, | |
property2: null, | |
resetOnInit: Ember.on('init', function() { | |
this.get('propertiesList').forEach((field) => { | |
const valueInObject = this.get('myObject').get(field); | |
this.set(field, valueInObject); | |
}); | |
}), | |
actions: { | |
modifyProperty2: function() { | |
console.log(this.get('myObject.property2'), this.get('property2')); | |
this.get('property2').push(2); | |
console.log(this.get('myObject.property2'), this.get('property2')); | |
} | |
} | |
}); |
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
{ | |
"version": "0.4.16", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.1.0/ember.debug.js", | |
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.1.0/ember-data.js", | |
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.1.0/ember-template-compiler.js" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment