Go straight to the code and I will explain more along the question
I have the index.html file like this:
<body class="horizontal-menu">
<!-- Preloader -->
<div id="preloader">
<div id="status"><i class="fa fa-spinner fa-spin"></i></div>
</div>
<div ng-if="isLoading">
<div id="status"><i class="fa fa-spinner fa-spin"></i></div>
</div>
<section>
<div class="contentpanel">
<!-- content goes here... -->
<error-page ng-if="error"></error-page>
<div ng-view ng-if="!isLoading && !error"></div>
</div>
</div><!-- mainpanel -->
</section>
</body>
I want to implement the indicator for my page, you can see the <div id="status"><i class="fa fa-spinner fa-spin"></i></div> as well as ng-if="isLoading" line.
In the login component I have these line of code to change from login view to register view.
$scope.onRegister = function () {
$rootScope.isLoading = true;
$location.path(routes.REGISTER);
}
What I want is when changing the view from login view to register view, the indicator (spinner) is up. After that, in the register component code I have these lines to force the spinner off.
function registerController($scope, $rootScope, $location, $http) {
$rootScope.isLoading = false;
}
But the spinner rounds endlessly.
I tried to read about $viewContentLoaded, and I put these line of code in my application (parent application) as well as the register controller.
$rootScope.$on('$viewContentLoaded', function (event) {
$rootScope.isLoading = false;
})
It still does not help.
Many thanks in advance for helping me solving that issue.