gokatz
3/17/2016 - 6:20 AM

componenet full test

componenet full test

{
  "version": "0.6.4",
  "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.4.1/ember.debug.js",
    "ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.4.0/ember-data.js",
    "ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.4.1/ember-template-compiler.js"
  }
}
import Ember from 'ember';

export default Ember.Component.extend({
  init() {
    this._super(...arguments);
  	console.log('----init----');
    console.log('----x----');
  },
  didReceiveAttrs() {
    this._super(...arguments);
  	console.log('----didReceiveAttrs---');
    console.log(`attribute post : ${this.get('post')}`);
    console.log('----x----');
  },
  willRender() {
    this._super(...arguments);
    console.log('----willRender----');
    this.set('post', `this is ${this.get('post')}`);
    console.log(this.get('post'));
    console.log('----x----');
  },
  didInsertElement() {
    this._super(...arguments);
    console.log('----didInsertElement----');
    console.log('----x----');
  },
  didRender() {
    this._super(...arguments);
    console.log('----didRender----');
    console.log('----x----');
  }
});
<h1>Welcome to {{appName}}</h1>
<br>
{{#each postMsg as |msg|}}
	{{#my-component post=msg.msg}}
  	<cite>- Author {{msg.authorName}} says {{msg.msg}}</cite>
  {{/my-component}}
{{/each}}
<br>
{{outlet}}
<br>
<br>
import Ember from 'ember';

export default Ember.Controller.extend({
  appName: 'Ember Twiddle',
  postMsg: [{msg : 'hai', authorName: 'gokul'}, {msg : 'hello', authorName: 'yuvi'},{msg : 'great', authorName: 'prasanth'}]
});