title: $anchorScroll is working on second click, when I have called in other submit function
body: <p>I am still facing this issue. My issue little a bit different</p>
  
  <p>I am calling my $anchorScroll function in other event. When form is being submitted. It is working on second click same as above. I have also tried earlier anwsered solution, but no luck :(</p>
  
  <pre><code> $scope.scrollTo = function(element) {
      var old = $location.hash();
      $location.hash(element);
      $anchorScroll();
      $( 'html, body').animate({
          scrollTop: $(element).offset().top
      }, 1000);
      $location.hash(old);
  };
  </code></pre>
  
  <p>And I am calling it in another function, which is submitting the form.</p>
  
  <pre><code> $scope.saveProfile = function (profile) {
   $log.debug("now the profile is " + JSON.stringify(profile));
   dataFactory.persistChange("profiles",profile,$scope,postSuccessUpdate);
    $scope.scrollTo( "#error ");
  }
  </code></pre>
  
  <p>And here is my anchor</p>
  
  <pre><code> &lt;div ng-class="statusDisplayClass" ng-show="messages" id="error"&gt;
         Here it will be displayed
        &lt;/div&gt;
  </code></pre>
  
  <p>Please help me on this. Where I am lacking.</p>