Skip to content

Instantly share code, notes, and snippets.

@pzuraq
Last active January 28, 2018 23:31
Show Gist options
  • Save pzuraq/7fb92d3c6d73652c7fd850a95bac2794 to your computer and use it in GitHub Desktop.
Save pzuraq/7fb92d3c6d73652c7fd850a95bac2794 to your computer and use it in GitHub Desktop.
ES Class Demo
import Ember from 'ember';
let FooComponent = Ember.Component.extend({
baz: Ember.computed('foo', function() {
return this.get('foo');
}),
fooObserver: Ember.observer('foo', function() {
this.set('qux', 'quux');
}),
actions: {
updateFoo() {
this.set('foo', 'bazzz');
}
}
});
export default class MyComponent extends FooComponent {
constructor() {
super();
this.foo = 'bar';
}
}
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
<div>
foo: {{foo}}
</div>
<div>
baz: {{baz}}
</div>
<div {{action 'updateFoo'}}>
qux: {{qux}}
</div>
{
"version": "0.13.0",
"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.16.2",
"ember-template-compiler": "2.16.2",
"ember-testing": "2.16.2"
},
"addons": {
"ember-data": "2.16.3"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment