Essentially, you have connected scope properties to the view and initialized them with values from service properties in your code:
var myApp = angular.module('myApp', []);
myApp.service('s1', function() {
this.Input = {
name: 'John'
};
this.name = 'Doe';
});
myApp.controller('c1', function($scope, s1) {
$scope.Input = s1.Input;
$scope.name = s1.name;
});
myApp.controller('c2', function($scope, s1) {
$scope.Input = s1.Input;
$scope.name = s1.name;
$scope.change = function() {
console.log("s1.name = "+s1.name);
s1.name = "ciao";
console.log("s1.name = "+s1.name);
};
});
However, altering the value of $scope.name in the c2 controller does not affect s1.name, and changing s1.name via the $scope.change method in the c2 controller doesn't reflect on $scope.name.
One solution to propagate changes in service properties is by utilizing events - triggering events from the service and listening for them in the controllers. For more information, refer to How do I create a custom event in an AngularJs service.
Here is the updated jsfiddle link: http://jsfiddle.net/0j0mdjco/2/