Skip to content

Instantly share code, notes, and snippets.

@kumkanillam
Last active March 26, 2017 18:48
Show Gist options
  • Save kumkanillam/0e41054382b29643a7785c1536308d48 to your computer and use it in GitHub Desktop.
Save kumkanillam/0e41054382b29643a7785c1536308d48 to your computer and use it in GitHub Desktop.
import Ember from 'ember';
export default Ember.Component.extend({
didUpdateAttrs(){
console.log('didUpdatte');
},
didReceiveAttrs(){
this._super(...arguments)
console.log('didRecieve');
},
willUpdate(){
console.log('willupdate');
},
didRender(){
console.log('didRender');
},
actions:{
add(){
//this.get('model').pushObject(4);
this.sendAction('add',4);
}
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
init(){
this._super(...arguments);
this.set('contArr',[50,51]);
},
actions:{
add(val){
//this.get('contArr').pushObject(52);
this.get('model').pushObject(4);
//this.get('model').clear();
//let a =[11,222];
//this.set('model',a);
}
}
});
import Ember from 'ember';
export default Ember.Route.extend({
init(){
this._super(...arguments);
this.set('result',[1,2,3]);
},
model(){
return this.get('result');
}
});
<h1>Welcome to {{appName}}</h1>
{{#each model as |row|}}
{{row}}
{{/each}}
<br>
{{my-component model=model contArr=contArr len=4 add='add'}}
<br>
{{outlet}}
<br>
<br>
{{#each model as |row|}}
{{row}}
{{/each}}
<br />
{{#each contArr as |row|}}
{{row}}
{{/each}}
<button {{action 'add'}}> Add - length{{len}} </button>
{{yield}}
{
"version": "0.12.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.12.0",
"ember-template-compiler": "2.12.0",
"ember-testing": "2.12.0"
},
"addons": {
"ember-data": "2.12.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment