I have an object that indicates that the page is loading. However, it is not working correctly, it follows code:
HTML:
<div class="fundo_login">
<div class="carregando_inicio" ng-if="carregando == true"> //Quando carregando for TRUE mostra o spinner
<img src="/provas/app/imagens/spinning-circles.svg"/>
</div>
<div class="box_login" ng-if="carregando == false"> //Quando for false, mostra o conteúdo.
<div class="painel_cadastro">
<div class="logo_fabet">
<img src="app/imagens/logo_fabet.jpg">
</div>
</div>
</div>
</div>
JS:
$scope.carregando = true;
$scope.acabou = function() {
$timeout(function(){
$scope.carregando = false;
}, 3000);
}
$scope.acabou();
Note that loading starts as TRUE so that the spinner will appear soon after 3 seconds its status is changed to FALSE, causing the spinner to disappear and the content to appear. Parts are working. What is wrong is that when the page starts loading, the two appear together (for a few thousandths of a second), not respecting ng-if, as shown below:
Another question, how could I do to disappear the spinner and display the content only when the page is fully loaded?