Skip to content

Instantly share code, notes, and snippets.

@HenryVonfire
Last active January 21, 2016 13:04
Show Gist options
  • Save HenryVonfire/a622768f91572a94938c to your computer and use it in GitHub Desktop.
Save HenryVonfire/a622768f91572a94938c to your computer and use it in GitHub Desktop.
SO example
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
info:[{label:'a', value:'1'}],
actions:{
changeInfo(){
const info = this.get('info');
Ember.setProperties(info[0],{
label: 'b',
value: '2'
});
}
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{#each info as |item|}}
<span class="value">{{item.value}}</span>
<span class="label">{{item.label}}</span>
{{/each}}
<button {{action 'changeInfo'}}>change it!</button>
<br>
<br>
{
"version": "0.5.0",
"EmberENV": {
"FEATURES": {}
},
"options": {
"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.2.0/ember.debug.js",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.2.0/ember-data.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.2.0/ember-template-compiler.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment