I have worked my way through the angular.js tutorial.
I noticed something in step 7, an issue that seems to be true for most angular apps: https://docs.angularjs.org/tutorial/step_07
On the page load or a page refresh of a route that leads to the partial the following appears to occur: index.html's DOM is displayed. Then the partial view is loaded and then displayed. This causes the "sort by" text to then be shifted to the next line. (assuming you're on a lower res monitor). I am not happy with this style of loading. I explain it a bit better below.
Here is a simplification of the problem that indicates that the ng-view is causing an unaesthetic load.
index.html
<!doctype html>
<html lang="en" ng-app="phonecatApp">
<head>
<meta charset="utf-8">
<title>Google Phone Gallery</title>
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="css/app.css">
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="js/app.js"></script>
<script src="js/controllers.js"></script>
</head>
<body>
outer top
<div ng-view></div>
outer bottom
</body>
</html>
The text.html
partial:
<div>
Some Text
</div>
The routing:
var phonecatApp = angular.module('phonecatApp', [
'ngRoute',
'phonecatControllers'
]);
phonecatApp.config(['$routeProvider',
function($routeProvider) {
$routeProvider.
when('/text', {
templateUrl: 'partials/text.html',
controller: 'PhoneListCtrl'
});
}]);
and finally an empty controller:
phonecatControllers.controller('PhoneListCtrl', ['$scope', '$http',
function($scope, $http) {
}]);
When directing to or refreshing the URL to the /text
page it briefly renders as such for a split second:
outer top outer bottom
And then suddenly changes to
outer top
Some Text
outer bottom
What can I do to cleanly make a simplistic partial view load smoother?