I'm trying to share a service value between 2 controllers, but the two-way data binding isn't working. Is it possible doing that without using ng-model?
// script.js
angular.module("MyApp")
    .factory("ValuesStore", function() {
        var service = {};
        service.visible = true;
        service.toggle = toggle;
        function toggle() {
            console.log(service.visible);
            service.visible = !service.visible;
        }
        return service;
    });
function FirstController($scope, ValuesStore) {
    $scope.visible = ValuesStore.visible;
    $scope.toggle = ValuesStore.toggle;
}
function SecondController($scope, ValuesStore) {
    $scope.visible = ValuesStore.visible;
}
<!-- template -->
<div ng-controller="FirstController">
    {{ visible }}
</div>
<div ng-controller="SecondController">
    {{ visible }}
</div>
All the examples I have seen use input elements with ng-model. Maybe I should do this using watchers or broadcast.
 
     
     
     
     
    