title: when to use factory and when to use service - counter approach is suggested in a book
body: <p>I'm reading <a href="https://rads.stackoverflow.com/amzn/click/com/1783983566" rel="nofollow noreferrer" rel="nofollow noreferrer">this book</a> about angular's services. When summarizing about when to use <code>service</code> and <code>factory</code> methods of provider the author states the following:</p>
  
  <blockquote>
    <p>The service method should be used if you define your services as a class and  need to invoke the definition's constructor function. Use
    the factory method if you define your service as an object instance
    and do not need to invoke a constructor.</p>
  </blockquote>
  
  <p>I'm wondering whether this is a typo or I have been misusing them. I've always used the <code>factory</code> method to get constructors and <code>service</code> when I needed instances.</p>
  
  <p><strong>EDIT</strong>:</p>
  
  <p>For example, I have a validator service and each controller in the app should have it's own instance. I define it as a class:</p>
  
  <pre><code>function ValidatorService() {
      this.addErrorRule = function (event, rule) {};
      this.validate = function (values) {}
  }
  </code></pre>
  
  <p>Now, I would define it in the angular system using <code>factory</code> method like this:</p>
  
  <pre><code>angular.module("validation").factory('ValidatorService', function () {
      return ValidatorService;
  });
  </code></pre>
  
  <p>Whenever a controller requires <code>ValidatorService</code> it will be provided with the constructor from which a service can be instantiated.</p>
  
  <p>But according to the quote:</p>
  
  <blockquote>
    <p>The service method should be used if you define your services as a
    class and  need to invoke the definition's constructor function.</p>
  </blockquote>
  
  <p>I should have done like this:</p>
  
  <pre><code>angular.module("validation").service('ValidatorService', ValidatorService);
  </code></pre>
  
  <p>But in this case angular will instantiate one instance of the service which will be shared among all controllers.</p>