Skip to content

Instantly share code, notes, and snippets.

@andybluntish
Last active May 24, 2018 04:18
Show Gist options
  • Save andybluntish/3cfa7869ab0cbecff70de4378843fc60 to your computer and use it in GitHub Desktop.
Save andybluntish/3cfa7869ab0cbecff70de4378843fc60 to your computer and use it in GitHub Desktop.
Overriding CP
import Ember from 'ember';
export default Ember.Component.extend({
firstName: 'John',
lastName: 'Doe',
fullName: Ember.computed('firstName', 'lastName', {
get() {
return `${this.get('firstName')} ${this.get('lastName')}`.trim()
},
/*set(prop, value) {
return `[setter: ${value}!]`
}*/
})
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
<br>
<br>
{{my-component fullName="Overridden Fullname"}}
{
"version": "0.13.1",
"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.12.0",
"ember-template-compiler": "2.12.0",
"ember-testing": "2.12.0"
},
"addons": {
"ember-data": "2.16.3"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment