Askar
Askar

Reputation: 523

Access property inside Ember component

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

Upvotes: 0

Views: 161

Answers (1)

Ember Freak
Ember Freak

Reputation: 12872

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') } 
})

Upvotes: 1

Related Questions