gokatz
4/22/2016 - 1:36 PM

Component rerender

Component rerender

{
  "version": "0.7.2",
  "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.1.2",
    "ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.4.3/ember-data.js",
    "ember-template-compiler": "2.1.2"
  }
}
<hr>
<p>My Comp</p>
{{yield}}

{{a}}
{{b}}
{{c}}

<button {{action 'changeOne'}}>Change One</button>
<button {{action 'changeTwo'}}>Change Two</button>
<button {{action 'changeThree'}}>Change Three</button>
<br>
<hr>
<h1>Welcome to {{appName}}</h1>
<br>

<button {{action 'changeOne'}}>Change One</button>
<button {{action 'changeTwo'}}>Change Two</button>
<button {{action 'changeThree'}}>Change Three</button>

<br>
{{my-component a=one b=two c=three}}
{{outlet}}
<br>
<br>
import Ember from 'ember';

export default Ember.Controller.extend({
  appName: 'Ember Twiddle',
  one: 1,
  two: 2,
  three: 3,
  actions: {
  	changeOne() {
      var val = this.get('one')+10;
    	this.set('one', val);
    },
    changeTwo() {
      var val = this.get('two')+10;
    	this.set('two', val);
    },
		changeThree() {
      var val = this.get('three')+10;
    	this.set('three', val);
    }
  }
});
import Ember from 'ember';

export default Ember.Component.extend({
  didRender() {
  	console.log('rerendered');
  },
  
  actions: {
  	reset() {
    	this.refersh();
    },
      	changeOne() {
      var val = this.get('a')+1;
    	this.set('a', val);
    },
    changeTwo() {
      var val = this.get('b')+1;
    	this.set('b', val);
    },
		changeThree() {
      var val = this.get('c')+1;
    	this.set('c', val);
    }
  }
});