Skip to content

Instantly share code, notes, and snippets.

@derrickshowers
Created August 30, 2016 03:22
Show Gist options
  • Save derrickshowers/b6ede470b0c802677bf2647436c4b073 to your computer and use it in GitHub Desktop.
Save derrickshowers/b6ede470b0c802677bf2647436c4b073 to your computer and use it in GitHub Desktop.
Ember.object.create Test
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
testObject: Ember.Object.create({
emberObj: Ember.Object.create({
foo: 'foo',
}),
nonEmberObj: {
foo: 'foo',
}
}),
init() {
this._super(...arguments);
console.log('===== testObject.emberObj =====');
console.dir(this.get('testObject.emberObj'));
console.log('type: ', this.get('testObject.emberObj').toString());
console.log('===============================');
console.log('==== testObject.nonEmberObj ===');
console.dir(this.get('testObject.nonEmberObj'));
console.log('type: ', this.get('testObject.nonEmberObj').toString());
console.log('===============================');
}
});
<h3>Does Ember.Object.create() apply to nested objects?</h3>
<p>Nope!</p>
<p>Open the console and take a gander...</p>
{
"version": "0.10.4",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.7.0",
"ember-data": "2.7.0",
"ember-template-compiler": "2.7.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment