Skip to content

Instantly share code, notes, and snippets.

@baroquon
Created December 23, 2016 18:20
Show Gist options
  • Save baroquon/9dbcb7b27afb989276923a0f97149bf2 to your computer and use it in GitHub Desktop.
Save baroquon/9dbcb7b27afb989276923a0f97149bf2 to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
let baseObj = Ember.Object.extend({
talk(){
alert('hey from baseObj');
}
});
let extendObj = baseObj.extend({
talk(){
alert('hey from extendObj');
this._super();
}
});
let createObj = extendObj.create({
otherTalk(){
console.log(createObj);
this.talk();
}
});
export default Ember.Controller.extend({
createObj: createObj,
appName: 'Ember Twiddle',
fireTalk(obj){
obj.otherTalk();
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
<br>
<br>
<button{{action fireTalk createObj}}>createObj</button>
{
"version": "0.10.7",
"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.10.0",
"ember-data": "2.10.0",
"ember-template-compiler": "2.10.0",
"ember-testing": "2.10.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment