angularjs - How to update the $scope variable values with the new Values I'm getting from the Database? -
i have been setting response values every time hit web-service
$scope
variable on click of button $scope
variable not getting updated new values have click button twice $scope
variables updated. have checked, each time hit button web-service
getting called.
controller.js
$scope.getdetails = function() { services.getsomedetails($scope.id).then(function(response) { $scope.details= response.data; } }
view.html
<a ng-click="getdetails();">click me!</a>
use $scope.$apply()
after scope variable.
services.getsomedetails($scope.id).then(function(response) { $scope.details= response.data; $scope.$apply(); }
Comments
Post a Comment