Do something when Ember component is instantiated?

ember.js

Solution

You can run this code in the init method

init:function(){
    this._super();
    hideIf = this.get('hideIf');
    key = this.get('key')
        if(hideIf === key){
              this.set('class', 'hide');
        }
    }

Good luck

PD: now this method is private: http://emberjs.com/api/classes/Ember.Component.html#method_init

Problem

I call a component like this: ``` {{Gd-text-input label="Specify" name="Specify" key="entry.810220554" triggerKey="tada" hideIf="Client"}} ``` I would like to run some javascript-code that sets an additional property to this component. What I'm trying to run is something like this ``` //Convert string ot array. GdRadioInput = Em.Component.extend({ init: function(){ var cs = this.get('contentString'); console.log('doesthiswork?'); if(cs){ this.set('content', eval(cs)); } } }); ``` But it doesn't run. If someone could just provide a sample that console.logs a the value of a property of a component whenever that component is created, that would be very helpful.

Original source