title: What is best practice in angular when it comes to the seperation of data and logic
body: <p>Currently I have a bunch of controllers that seems a little too bulky for my liking in that they manage both the logic and the storing of data.</p>
  
  <p>For instance let us take a over simplified register controller:</p>
  
  <pre><code>$scope.username = "";
  $scope.password = "";
  
  $scope.validateUsername= function(){
    ......
  }
  $scope.validatePassword= function(){
    ......
  }
  
  $scope.updateUserConfig = function(){
       //a rest call here
  }
  </code></pre>
  
  <p>ok so to me this seems like it is wrong because the controller is storing data, performing logic and making calls to a rest service.</p>
  
  <p>I thought the controller should be the logic for the view it is used for while the "model" i.e. username and password should be somewhere else as well as the call to the rest service.</p>
  
  <p>I have looked about and have seen people employing factories that are injected into the controller for the rest calls; as these factories will not store state they can be shared across the entire application, so this seems like  a good idea ?</p>
  
  <p>I am unsure about the data aspect though, is it normal for data to be stored within the controller or is there a better practice for this?</p>