title: Making an Angular Service to Maintain a counter
body: <p>I am trying to experiment with angular services. As a test I wanted to make a simple counter which incremented across multiple controllers and throughout the browser life cycle. My service seems to be re-initialized in each controller, any ideas ?</p>
  
  <p><strong>NOTE: Controllers are on different pages - so there is a page reload</strong></p>
  
  <pre><code>angular.module('myApp').service('Session', function($http) {
  
      this.inc = function() {
          console.log("INC Called and Global is :" + this.count);
          if(this.count) {
              this.count++;
          } else {
              this.count = 0;
          }
  
     };
  
      this.get = function() {
          return this.count;
      };
  
  });
  </code></pre>
  
  <p>And then in the controller I call</p>
  
  <pre><code>Session.inc();
  </code></pre>
  
  <p>and</p>
  
  <pre><code>Session.get();
  </code></pre>