Passing value from one page to another page in service portal

sameer S
Tera Contributor

Hi , 

I have widget1 in page1 and I need to pass the request "number" value from page1 to widget2 page2 , when I click on a  request number on page1 , it should take me to page2 and fetch the "number" value .I need to pass that number to a script include function and show the values on page2 for that specific request. Please help!

 

Thanks in advance!

1 REPLY 1

Sonali Nimbalk1
Giga Guru

Hi @sameer S,

 

In angular, the $broadcast is used to send an event to other angular directives/widgets.

In order to listen to a broadcast, you must use angulars $on function.

 

You can also send arguments from $root.$broadcast with something like this:

$rootScope.$broadcast('eventName', true);

Then your function has something to use as data when the event is picked up in the other widget.

$rootScope.$on('eventName', function(event,data) {
   var myVar = data;
});

 

Example:

 

In Widget 1:

SonaliNimbalk1_0-1685079052182.pngSonaliNimbalk1_1-1685079063086.png

 

In Widget 2:

 

SonaliNimbalk1_2-1685079095100.pngSonaliNimbalk1_3-1685079103883.png

 

SonaliNimbalk1_4-1685079111809.png

 

 

Please hit like and mark my response as correct if that helps
Regards,
Sonali Nimbalkar