title: How to access the controller value from service in angularjs?
body: <p>I want to access the controller values from service, how can I access it. I am try to access the controller values by using the following code.
  <a href="http://jsbin.com/cacabavatu/1/edit?html,output" rel="nofollow">The code is here JsBin.com</a></p>
  
  <pre><code>    &lt;script&gt;
  
      var app = angular.module('app', [])
  .controller("ctrl1",['$scope','svc',function($scope,svc){
  
      $scope.fun1=function(){
        svc.service_set();
  
        alert(svc.txt1);
        alert(svc.txt2);
  
      }
  
  }])
  .controller("ctrl2",['$scope','svc',function($scope,svc){
  
      $scope.fun2=function(){
          svc.service_set();
  
          alert(svc.txt1);
          alert(svc.txt2);
      }
  
  }]).
  service("svc",function(){
        var svc={};
        svc.service_set=function()
        {
          //I want to access the controller values from here
          svc.txt1=ctrl1.c1txt1; 
          svc.txt2=ctrl2.c2txt1;
  
        }
  
        return svc;
      })
  ;
  
      &lt;/script&gt;
  </code></pre>