Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4826

How to call function inside another action and get its return value in component's "actions" hook?

$
0
0

@Enterpub wrote:

How to call function inside another action and get its return value in component's "actions" hook? For example,
// components/some-comeponent.js

actions: {
     action1() {
          const value = this.send("action2", 40);
          console.log(value);
     },

     action2(someNumber) {
          return someNumber / 2;
     }
}

the output of executing of "action1" function is going to be undefined. I search for a solution, which outputs 20.
Thank you

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4826

Trending Articles