Quantcast
Viewing all articles
Browse latest Browse all 4827

Update textarea value

@frsechet wrote:

I have this code here, and in a component, a textarea that I would like to prefill with a value that I get from intentsService.

my-component.js:

export default Ember.Component.extend({

  intentsService: Ember.inject.service('intents'),
  intent: Ember.computed.alias('intentsService.intent'),
  mytextarea: null,
  intentObs: Ember.observer('intent', function () {
    this.set('mytextarea', this.get('intent').response);
  })

});

my-component.hbs:

{{textarea value=newAnswer id="advanced-answer"}}

However, my service being a bit slow to respond, the component is created before the intent.response exists, and when the observer triggers, it's too late and the textarea doesn't update with the correct value.

Any idea how I can do that?

Thanks!

Posts: 5

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4827

Trending Articles