jordan jordan - 1 year ago 67
AngularJS Question

How to update the $scope variable values with the new Values I'm getting from the Database?

I have been setting the response values every time I hit the

to a
variable on click of a button but the
variable is not getting updated with the new values I have to Click the button twice so that the
variables get updated. also I have checked, each time I hit the button the
is properly getting called.


$scope.getDetails = function() {
services.getSomeDetails($ {




<a ng-click="getDetails();">Click me!</a>

Answer Source

Use $scope.$apply() after your scope Variable.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download