Skip to content

Instantly share code, notes, and snippets.

@jenweber
Last active May 1, 2019 12:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jenweber/203479d64a650c9e7e673d56aee8568f to your computer and use it in GitHub Desktop.
Save jenweber/203479d64a650c9e7e673d56aee8568f to your computer and use it in GitHub Desktop.
Setting CPs
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
firstname: '',
lastname: '',
fullName: Ember.computed('firstname', 'lastname', function() {
return `${this.get('firstname')} ${this.get('lastname')}`
}),
actions: {
setCP() {
this.fullName = 'batman'
// console.log(this.fullName)
this.set('fullName', 'batman')
}
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
{{input value=firstname}}
{{input value=lastname}}
<div>
{{fullName}}
</div>
<button {{action 'setCP'}}>set</button>
<br>
<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": "2.12.0",
"ember-template-compiler": "2.12.0",
"ember-testing": "2.12.0"
},
"addons": {
"ember-data": "3.4.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment