Skip to content

Instantly share code, notes, and snippets.

@alagiz
Created May 25, 2016 07:59
Show Gist options
  • Save alagiz/00f9a36a4ad0718eabfb5575f0890397 to your computer and use it in GitHub Desktop.
Save alagiz/00f9a36a4ad0718eabfb5575f0890397 to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Component.extend({
init(){
this._super(...arguments);
this.list = Ember.String.w(this.attrs.list);
},
actions:{
add(val){
this.get('list').pushObject(val);
}
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
{{my-component list='apple orange cucumber' num=1}}<br>
{{my-component list='apple orange cucu' num=2}}<br>
{{outlet}}
<h2 id="title">da list {{num}}</h2>
{{input value=text}} <br>
<button {{action 'add' text}}>add</button><br>
{{#each list as |item|}}
item: {{item}}<br>
{{/each}}
{{yield}}
{
"version": "0.8.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.5.1",
"ember-data": "2.5.2",
"ember-template-compiler": "2.5.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment