-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Showing "loading" message #77
Comments
$scope.loaded = !!$templateCache.get(uri);
if (!$scope.loaded) {
loadTheUri(uri).then(function (result) {
$templateCache.put(uri, result);
$scope.loaded = true;
});
} <div>
<div ng-if="!loaded">
loading... <i class="fa fa-spinner fa-spin"></i>
</div>
<div ng-if="loaded">
<div hljs hljs-include="uri"></div>
</div>
</div> |
Interesting, let me experiment with this.. |
I created this helper function, and pointed hljs to hljsUri:
I still notice a lag, though. It seems likes hljs needs time to process and paint the source? That would not be a surprise, but the loading message disappears once the cache is loaded, the background of hljs appears, though empty, and a few tenth of a second later, the source is shown. I guess that if this would be added as a feature in hljs, it would be possible to show the loading message longer. It would also require less mess.. Thanks for the suggestion though, I'll use it for the time being! |
I am using hljs-include to pull in code from back-end, which takes half a second. Enough for end-users to notice. I also noticed that hljs initially shows the contents of the directive before replacing it with the result from the include. So I added a "loading.." message in there. Next thought was to add a spinner, something like:
Unfortunately, the i tag gets escaped, and shown as is. If I add hljs-no-escape, it gets stripped away. Would be fun if I could show a loading message with a spinner somehow. Is that possible with current hljs?
The text was updated successfully, but these errors were encountered: