title: sharing data[array] between controllers
body: <p>I need to share data between controllers. My data is actually an array. I am able to share the data successfully but I have one more requirement. I need to clear this array from one of the controller. I have written a function sharedService.clear() in my sharedService. But that doesn't work.  What am I doing wrong here?can anyone please help.</p>
  
  <pre><code>services.service('sharedProperties', function () {
     var sharedService =  {};
  
      sharedService.personArray = [];
  
      sharedService.setPersonArray = function(newObj) {
         this.personArray.push(newObj);
      };
      sharedService.getPersonArray = function(){
          return this.personArray;
      };
  
      sharedService.clear = function(){
          this.personArray = [];
      };
      return sharedService;
  
  });
  </code></pre>