Currently, I am making an AJAX request to retrieve data that is needed in the view to generate a list. My goal is to determine when the $scope has been updated and when the view has finished rendering after receiving a successful response. This will allow me to dynamically set initial values and event handlers for the list.
The code I am using at the moment is not achieving the desired outcome:
responsePromise.success(function (data, status, headers, config) {
var slideInfos = data;
$scope.slideInfos = slideInfos;
setInitialSliderValues();
});
When I call setInitialSliderValues(), the view is still not refreshed.
Attempting the following code leads to an error stating "$digest already in progress":
responsePromise.success(function (data, status, headers, config) {
var slideInfos = data;
$scope.$apply(function () {
$scope.slideInfos = slideInfos ;
setInitialSliderValues();
}
});
I am seeking advice on how to ensure that changes to the data have been applied to the page without resorting to using a timer to check for expected changes.