I want to show button(Some Button) while some logic is doing in my app, and then hide this button.
By clicking Some Button I call expand() where set data.loading to true, at this point I want to button appears, when I set data.loading to false I want to button hides, but view is not updates.
<button ng-show="data.loading">Some Button</button>
<button ng-click="expand(data)">Other Button</button>
Function:
$scope.expand = function (data) {
data.loading = true;
// Some Button must be visible now
// Some logic here;
data.loading = false;
// Some Button must be invisible now
}
$scope.$apply() - returns error: $apply already in progress
$scope.safeApply() - doesn't throw exception, but doesn't updates view.
$timeout - doesn't updates view.