Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Communicating between widget Portal issue

Ankit Singh5
Tera Contributor

I am using $rootscope.$emit() for communicating between widget and for listning $rootscpe.$on().

i am having two widget say A & B.

 

Step 1. Firstly I am sending data from A to B by using 

$rootScope.$emit('saveContinueSkillBehave', '');

 

Step 2. In B widget I am fetching by using 

$rootScope.$on('saveContinueSkillBehave', function(event,showCard) {

            // back to A from B
    $rootScope.$emit("saveContinueSkillBehaveTotalSkillPer", {
      "totalSkillPercentage":"100"
    }); 
});

 

Step 3. In A widget I am fetching by using

$rootScope.$on('saveContinueSkillBehaveTotalSkillPer', function(e, skillSaveData){
    console.log(skillSaveData);
});

 

so hear in step 3 when i am consoling the output i am getting console as shown in attach image.

As you can see in image

At first flow i am getting 1 time data on console.

At second flow i am getting 2 time data on console(containing first flow output as well)

At forth flow i am getting 4 time data on console(containing first, second, third flow output as well) and so on...

 

How can i prevent this and i want only final output. please post if anyone have correct solutions.

0 REPLIES 0