- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Hello Everyone,
You can use $rootScope.$broadcast to notify other widgets and $rootScope.$on to receive the notification
FIRING AN EVENT:
Go to your desired widget and on the client controller do something like this
TIPS:
- It is also great if you will put a 500 milliseconds timeout to broadcast just to ensure that all other widgets are loaded and ready to listen when we broadcast an event.
- Event name can be anything you want just come up on a name with a unique identifier
- Data can also be a JSON object. For this case, it’s just a string.
LISTENING TO AN EVENT
Go to your next widget where you want to listen on the event that you created, and do something like this
This can be very useful when you want to send data to other widgets.
If my content helped you in anyway, please mark this content as BOOKMARK, SUBSCRIBE & HELPFUL
Best Regards,
Prashant Kumar (LearnIT)
YouTube Channel LearnIT: https://www.youtube.com/@learnitwithprashant
Blog LearnIT: https://medium.com/@LearnITbyPrashant
Prashant Kumar LinkedIn: https://www.linkedin.com/in/learnitbyprashant/
ServiceNow Community Prashant Kumar - https://www.servicenow.com/community/user/viewprofilepage/user-id/19635
- 1,164 Views
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
