JSFiddle - React, Tailwind, and code Playground

HTML

<div ng-app="exampleApp">
    
    <div ng-controller="controller1">   
        {{ sharedData.someData }}
    </div>
    
    <div ng-controller="controller2">   
        <button ng-click="sharedData.someData='otherData'">Set Data</button>
    </div>

</div>

JavaScript

angular.module('exampleApp', []).controller('controller1', function(sharedData, $scope){
    $scope.sharedData = sharedData;      
}).controller('controller2', function(sharedData, $scope){
    $scope.sharedData = sharedData;       
}).service('sharedData', function(){
   this.someData = "test";
   return this;
});