AngularJS 1.4

HTML

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.6/angular.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://cdn.rawgit.com/angular-ui/bootstrap-bower/0.13.4/ui-bootstrap-tpls.js"></script>
<div ng-app="SharingDataBetweenControllers" ng-scope>
    <div ng-controller="Controller5a">
    first controller:<input ng-model="Share.text"/>
    </div>
    <div ng-controller="Controller5b">
    second controller: {{Share.text}}
    </div>
</div>

JavaScript

var module = angular.module('SharingDataBetweenControllers', []);

module.service('Share', function(){
     this.text = 'hello world';
     let self = this;
    return { 
     get: function(){
       return self.text;
    },
     set: function(value){
     self.text=value;
    },
    };
});

module.controller('Controller5a',function($scope, Share) {
  $scope.Share = Share.get();
  
});

module.controller('Controller5b', function($scope, Share) {
	$scope.Share = Share
	
});