0
votes

Need your help folks. How can I access property inside the component. Something like this:

export default Ember.Component.extend({
  cMsg: Ember.computed('msg', function() {
            return `${this.get('msg')} , ${this.get('msg')}`;
        }),

  selectedDomain: { msgPrefix: 'cMsg???' },  
});

Here is the twiddle: https://ember-twiddle.com/9acda203a89dbd3892059170ab665d08?openFiles=components.hello-there.js%2C

1
selectedDomain:Ember.computed('cMsg',function(){ return { msgPrefix: this.get('cMsg')} }) Not sure about exact problem you are facing - Ember Freak
I have not tried that. Let me try to run it. - Askar
Thanks so much @kumkanillam! Dunno why I did not try that. It seems it is working they way I want. ember-twiddle.com/… - Askar

1 Answers

1
votes

Most of the time we miss the usage of custom helper and computed property. In this case you can write computed property,

selectedDomain: Ember.computed('cMsg', function() { 
    return { msgPrefix: this.get('cMsg') } 
})