I have a question in the angularJs that I can not solve, my index.html
is the following:
<div ng-show="error" class="alert alert-danger">{{error}}</div>
<div ng-show="success" class="alert alert-success">{{success}}</div>
<div class="content">
<div ng-view></div>
</div>
To assign value to these views I would normally do the following:
if (response.data.success) {
$scope.success = response.data.success;
} else if (response.data.error) {
$scope.error = response.data.error;
}
Just by setting the value of $scope.error
or $scope.success
, the value is not displayed (I think it should be because div
is outside partial
), it only appears when I assign the value in $rootScope
, but the value continues to be displayed until there is some redirection, it is not cleared when an ajax request is executed (the angle automatic).
But briefly, my question is, is there any way to display the value of $scope
out of partial
? if not, how do I clear the value of $rootScope
without having to refresh the page?