A scope provides a separation between View and its Model. Every application has a $rootScope provided by AngularJS and every other scope is its child scope.
Using rootscope we can set the value in one controller and read it from the other controller.
var myApp = angular.module('myApp', );
function controllerOne($scope, $rootScope)
$rootScope.name = 'From Rootscope set in controllerOne';
function controllerTwo($scope, $rootScope)
$scope.name2 = $rootScope.name;
<div style="border: 5px solid gray; width: 300px;">
Setting the rootscope in controllerOne
As we know, Rootscope is the top-level data container in AngularJs, we can keep any data in rootscope and read it when needed.
For more details