0

In my index.html I have a sidebar that needs to be displayed only for certain views and not for all. So this sidebar is inside index.html and below it is the ng-view div. Also a global controller is associated with the body tag.

<body ng-controller='init'>
<div class='sidebar' ng-show='sidedisplay'>
</div>
<div ng-view=''></div>
</body>

Inside my init controller by default I have : $scope.sidedisplay = false; console.log('Here');

Now when I run the project, the html loads and I see the sidebar and then after some 4-5 seconds i get here in the console log and the sidebar disappears. Why is the controller loading so much later than the HTML?? How can i rectify this?

1 Answer 1

1

You probably want to make use of ng-cloak.

Sign up to request clarification or add additional context in comments.

5 Comments

I still see the side bar. now for 1-2 seconds
I applied the ng-cloak to the body
You may need to include some additional detail.
Like the code of your controller perhaps? You might also want to look into why it takes 4-5 seconds before your controller is even initialized.
Did you also apply the CSS that is suggested in the ng-cloak documentation?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.