Skip to content

Instantly share code, notes, and snippets.

@rtablada
Forked from raytiley/controllers.application.js
Last active March 25, 2016 03:45
Show Gist options
  • Save rtablada/4bb00da583f8bc683778 to your computer and use it in GitHub Desktop.
Save rtablada/4bb00da583f8bc683778 to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
todos: Ember.computed(function() {
return [];
}),
actions: {
add: function() {
let todos = this.get('todos');
this.set('todos', [...todos, 'added']);
}
}
});
<h1>Welcome to {{appName}}</h1>
<button {{action 'add'}}>Add</button>
<ul>
{{#each todos as |todo|}}
<li>{{todo}}</li>
{{/each}}
</ul>
{{outlet}}
<br>
<br>
{
"version": "0.7.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": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.4.3/ember.debug.js",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.4.3/ember-data.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.4.3/ember-template-compiler.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment