title: Angular service array empty
body: <p>I am trying to store JSON's data in a shared array within a service. The problem is that every time I want to update the service's array with some new content (e.g. new JSON), I need to first clear the array and after that the array remains empty, instead of loading new data.</p>
  
  <p>My service looks like this:</p>
  
  <pre><code>.service('jsonTest',
      function() {
        var json = [];
  
        function storeJson(file) {
          json=[];
          json.push(file);
        }
        return {
          storeJson: storeJson,
          showJson: json
        }
      });
  </code></pre>
  
  <p>As you can see, I am cleaning the array each time before loading new data with </p>
  
  <pre><code>json = [];
  </code></pre>
  
  <p>But then it still remains empty after loading new stuff.</p>
  
  <p>What am I doing wrong here?</p>
  
  <p>You can check that example here: <a href="http://plnkr.co/edit/tN9WvNminw1uLpThWPvu?p=preview" rel="nofollow">http://plnkr.co/edit/tN9WvNminw1uLpThWPvu?p=preview</a>
  The service is in app.js and is being used in MainCtrl (main.js) and ProductCtrl (product.js).</p>
  
  <p>Any advice please?</p>