title: How to update the $scope variable values with the new Values I'm getting from the Database?
body: <p>I have been setting the response values every time I hit the <code>web-service</code> to a <code>$scope</code> variable on click of a button but the <code>$scope</code> variable is not getting updated with the new values I have to Click the button twice so that the <code>$scope</code> variables get updated. also I have checked, each time I hit the button the <code>web-service</code> is properly getting called.</p>
  
  <p>controller.js</p>
  
  <pre><code>$scope.getDetails = function() {
    services.getSomeDetails($scope.id).then(function(response) {
  
              $scope.details= response.data;
  
    }
  }
  </code></pre>
  
  <p>view.html</p>
  
  <pre><code> &lt;a ng-click="getDetails();"&gt;Click me!&lt;/a&gt;
  </code></pre>