Long time ago I was thinking about this. I wanted to create a blog
entry, but never actually did it...
So, the solution is similar to ng-cloak, this is to use a directive,
for example:
<div cover-until='some message'>...</div>
This directive will set some predefined class. The CSS will match and
hide all the inner content, showing some spinner as a background
(defined in CSS).
Now, from within your controller, once your data are available, you will:
$scope.$broadcast('uncover:some message');
and the cover-until directive will remove the predefined class. That
will disable CSS style, as it will no longer apply.
I have never implemented it though. The directive will be trivial
(just add a class and remove it on message), but I cannot foresee if
the generic CSS definition is trivial or not. If that would help, the
directive could maybe append some extra div, so it would be simpler to
match CSS to show some spinner, like:
original markup:
<div cover-until="some text'>
...
</div>
modified by directive:
<div cover-until="some-text" class="covered">
...
<div class="cloak"></div>
</div>
and after scope emits message:
<div cover-until="some-text">
...
<div class="cloak"></div>
</div>
and CSS:
.covered * {
display: none;
}
div.cloack {
display: none;
}
.covered div.cloak {
display: block; /* overrides display:none */
background: ........
}
Regards,
Witold Szczerba