I get data with ajax, then i need to display it in my view and use isotope on DOM elements which i get with ng-repeat. So, i need to call $scope.$apply(); Then i get error: "digest already in progress".
I tried to use "safe-apply", but scope's phase is always digest, so apply do not fires. All i need is sort of callback of ng-repeat.
Now i have something like this:
$http({
method: 'GET',
url: '/web/main/json'
}).success(function (data, status, headers, config) {
$scope.cards = data.cards;
/* without this apply my DOM elements would be
invisible (if i use isotope on them)*/
$scope.$apply();
mainFunction(); // here i use isotope on my DOM elements
}).error(function (data, status, headers, config) {
alert("fail " + data);
});