title: How to react in the view to changes in the controller
body: <p>I understand that this maybe a very naïve question, however I haven’t been able to find a definite answer on the web so far.</p>
  
  <p>The question is how do I react in the view to changes in the controller? </p>
  
  <p>For example I wrote a login controller that uses a service to perform a request and should either let user in or inform him/her if the login attempt has failed:</p>
  
  <pre><code> var loginFormControllerFunction = function($scope, $log, $location, authenticationService){
      $scope.errorMessage = "";
  
      $scope.submit = function() {
          $scope.errorMessage = "";
          $scope.loginSuccessful = false;
          authenticationService.authenticate($scope.credentials.userName, $scope.credentials.password).then(
              function(user) {
                  var token = user.token;
                  //TODO: Receive token. Keep this guy logged for sometime.
                  $scope.loginSuccessful = true;
                  //TODO 2: Navigate to the main page.
              },
              function(errorMessage) {
                  $scope.errorMessage = errorMessage;
                  //TODO 3: remove zis from here!!!!
                  //alert (errorMessage);
              }
          );
      };
  };
  </code></pre>
  
  <p>Based on how I understand the concept of separation of concerns and mv* pattern, at this stage the controller <strong>should not</strong>:</p>
  
  <ol>
  <li>directly perform any navigation from the page (at the line TODO 2)</li>
  <li>interact with UI in any fashion by popping up notifications etc (TODO 3).</li>
  </ol>
  
  <p>In my understanding it should instead raise corresponding events (?)/ somehow inform whoever concerned about the result of the login operation. 
  Then the view should 
  navigate </p>
  
  <ol>
  <li>to the main page if the login attempt was successful</li>
  <li>or show a pop up otherwise</li>
  </ol>
  
  <p>What am I missing? What is the best way to achieve this with angularjs?</p>
  
  <p>Thanks.</p>