Created
October 3, 2016 16:20
-
-
Save vinilios/491784598b762ee046a60f0145514960 to your computer and use it in GitHub Desktop.
strange-cp-updates
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 { | |
set, get, on, computed | |
} = Ember; | |
const MyClass = Ember.Object.extend({ | |
fullname: computed('profile', 'profile.name', 'profile.surname', function() { | |
console.log("resolve fullname"); | |
return get(this, 'profile.name') + ' ' + get(this, 'profile.surname'); | |
}), | |
toStringExtension() { | |
console.log("toString"); | |
return get(this, 'fullname'); | |
} | |
}); | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
setModel: on('init', function() { | |
let model = MyClass.create({ | |
profile: Ember.Object.create({ | |
name: 'myname', | |
surname: 'mysurname' | |
}) | |
}); | |
let model2 = model.constructor.create({ | |
profile: model.get('profile') | |
}); | |
set(this, 'model', model2); | |
}) | |
}); |
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.10.5", | |
"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.8.0", | |
"ember-data": "beta", | |
"ember-template-compiler": "2.8.0", | |
"ember-testing": "2.8.0" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment