Skip to content

Instantly share code, notes, and snippets.

@nightire
Last active November 1, 2015 14:37
Show Gist options
  • Save nightire/7b1be58719446614b907 to your computer and use it in GitHub Desktop.
Save nightire/7b1be58719446614b907 to your computer and use it in GitHub Desktop.
The simplest todo-ish app in recently Ember
import Ember from 'ember';
let { RSVP, A, Object } = Ember;
export default Ember.Route.extend({
model() {
return RSVP.resolve(A([
Object.create({ name: 'Channel 1' }),
Object.create({ name: 'Channel 2' })
]))
},
actions: {
addChannel(model, name) {
model.addObject({ name })
this.controllerFor('application').set('name', '')
}
}
});
<ul>
{{#each model key="name" as |channel|}}
<li>{{channel.name}}</li>
{{/each}}
</ul>
<form {{action "addChannel" model name on="submit"}}>
{{input type="text" value=name}}
</form>
{
"version": "0.4.16",
"EmberENV": {
"FEATURES": {}
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.1.0",
"ember-data": "2.1.0",
"ember-template-compiler": "2.1.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment