Passing value from one page to another page in service portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2023 03:23 PM
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2023 10:32 PM
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:
In Widget 2:
Please hit like and mark my response as correct if that helps
Regards,
Sonali Nimbalkar