Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save scalvert/4f39018a123fda5fd864f635c8297f85 to your computer and use it in GitHub Desktop.
Save scalvert/4f39018a123fda5fd864f635c8297f85 to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
class MyModel extends Ember.Object {
constructor() {
super();
this._first = "Ricardo";
this._last = "Mendes";
}
get first() {
return this._first;
}
set first(v) {
this._first = v;
this.notifyPropertyChange('fullname');
}
get last() {
return this._last;
}
set last(v) {
this._last = v;
this.notifyPropertyChange('fullname');
}
get fullname() {
return this._first ? (this._last ? this._first + " " + this._last : this._first) : this._last;
}
}
export default class MyController extends Ember.Controller {
init() {
super.init(...arguments);
this.appName = 'Ember ES6 Demo';
this.model = new MyModel();
}
};
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
<br>
<br>
<h3>{{model.fullname}}</h3>
<div>
first: {{input value=model.first}}
</div>
<div>
last: {{input value=model.last}}
</div>
{
"version": "0.11.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.10.2",
"ember-data": "2.11.0",
"ember-template-compiler": "2.10.2",
"ember-testing": "2.10.2"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment