Implement poor man's ngCloak based on app controller

ngCloak is removed by angular when parsing the template, however this
doesn't seem to be enough to keep the content hidden until the
application is completely ready.

We accomplish this by setting `display: none` to the `body` element and
maing it display again when our main controller starts, at which point
we know everything is up and running.
This commit is contained in:
Juan Cruz Viotti 2015-12-15 09:51:58 -04:00
parent e01e3591e9
commit 2cb79090d1
3 changed files with 7 additions and 2 deletions

View File

@ -64,6 +64,9 @@ app.controller('AppController', function($q, DriveScannerService, SelectionState
this.restart();
// We're ready to unhide the application now
document.querySelector('body').style.display = 'initial';
this.selectImage = function() {
return $q.when(dialog.selectImage()).then(function(image) {
self.selection.setImage(image);

View File

@ -63,6 +63,9 @@ app.controller('AppController', function($q, DriveScannerService, SelectionState
this.restart();
// We're ready to unhide the application now
document.querySelector('body').style.display = 'initial';
this.selectImage = function() {
return $q.when(dialog.selectImage()).then(function(image) {
self.selection.setImage(image);

View File

@ -3,7 +3,6 @@
<head>
<title>Herostratus</title>
<link rel="stylesheet" type="text/css" href="../node_modules/flexboxgrid/dist/flexboxgrid.css">
<link rel="stylesheet" type="text/css" href="../node_modules/angular/angular-csp.css">
<link rel="stylesheet" type="text/css" href="../build/css/main.css">
<link rel="import" href="components/hero-badge.html">
@ -15,7 +14,7 @@
<script src="../build/browser/app.js"></script>
</head>
<body ng-app="Herostratus" ng-controller="AppController as app" ng-cloak>
<body ng-app="Herostratus" ng-controller="AppController as app" style="display: none">
<div class="content row middle-xs space-horizontal-large">
<div class="col-xs">