Skip to content

Instantly share code, notes, and snippets.

@k-fish
Created August 7, 2019 18:42
Show Gist options
  • Save k-fish/113f55c88daed54095648dafd2b50517 to your computer and use it in GitHub Desktop.
Save k-fish/113f55c88daed54095648dafd2b50517 to your computer and use it in GitHub Desktop.
Mixin behaviour
import Ember from 'ember';
import A from 'app/mixin/a';
import B from 'app/mixin/b';
export default Ember.Controller.extend(A, {
appName: 'Ember Twiddle',
value: 'nothing',
foo() {
this._super();
},
actions: {
changeValue() {
this.foo();
}
}
}, B);
import Mixin from "@ember/object/mixin";
export default Mixin.create({
foo() {
this.set('value', 'a');
}
});
import Mixin from "@ember/object/mixin";
export default Mixin.create({
foo() {
this._super();
}
});
<h1>Mixins</h1>
<br>
<br>
Value: {{value}}
<br>
<br>
<br>
<br>
<button {{action 'changeValue'}}>Change Value</button>
<br>
{
"version": "0.15.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.4.3",
"ember-template-compiler": "3.4.3",
"ember-testing": "3.4.3"
},
"addons": {
"ember-data": "3.4.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment