Skip to content

Instantly share code, notes, and snippets.

@patrickberkeley
Last active February 6, 2016 05:54
Show Gist options
  • Save patrickberkeley/e44bcb878f3e793f4b8d to your computer and use it in GitHub Desktop.
Save patrickberkeley/e44bcb878f3e793f4b8d to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
const {
get,
set
} = Ember;
export default Ember.Controller.extend({
singleVal: '',
actions:{
addField() {
get(this, 'model.images').addObject(get(this, 'singleVal'));
set(this, 'singleVal', '');
}
}
});
import Ember from 'ember';
export default Ember.Route.extend({
model:function(){
return {
images: [ ]
}
}
});
{{#each model.images as |info|}}
<label>image:</label>
{{input value=info}}<br/>
{{/each}}
image {{input value=singleVal}}
<br/><br/>
<button {{action "addField"}}>
ADD INPUT FIELD
</button>
{
"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