We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

send data from one widget to other

Rosy14
Kilo Sage

Hi, I have 2 widgets. I want to send a data to other widget. in second widget data is not coming.

 

Widget 1:

 

HTML:

 

<button class="btn btn-primary action-btn pull-right" ng-click="selectItem(item.u_zoom_link)">Register</button>

 

Client script:

 

$scope.selectItem= function(eventObj){
alert(eventObj);  //Working
c.selectedEvent= eventObj;
$rootScope.$broadcast('showEventDetails', eventObj);
};

 

Widget 2:

 

HTML:

 

<p>
Test: {{c.showForm}}  //Not working
</p>

 

Client Script:

 

function($rootScope) {
  var c = this;
      c.showForm = "";
        //Listening for "showEventDetails" event
  $rootScope.$on('showEventDetails', function(event,obj) {
alert("test"); // Not coming
            c.showForm= obj;
  });
}
 
1 REPLY 1

Ankur Bawiskar
Tera Patron

@Rosy14 

this link has the approach. you need to broadcast

How to comunicate between widgets - Service Portal 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader