How to share data between controllers using $rootScope?
In AngularJS, $rootScope is a global object that allows sharing data and events across different controllers. Since all controllers inherit from $rootScope, it can be used for data sharing and….