
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
angular-pretty-load
Advanced tools
Load your images in style using Angular: add an overlay before and during the image load, with the exact same position and dimensions of the image.
| Without Angular Pretty Load | With Angular Pretty Load |
|---|---|
![]() | ![]() |
Just use Bower.
bower install angular-pretty-load --save
Then, inject it into your application:
angular.module('MyApp', ['platanus.prettyLoad']);
In order to use the most basic mode, you should specify both the width and height of the image in your CSS
<img pretty-load ng-src="http://your.image.jpg">
If one or both dimensions are not specified in your CSS, but the API you're consuming or the server behind can provide the original size use this:
<img ng-src="{{image.src}}"
pretty-load
pretty-load-width="{{image.width}}"
pretty-load-height="{{image.height}}">
The directive will not override properties given to the image (width: 100%), but it will complete both width and height based on the original image ratio.
You can set a common overlay color for all images:
.pretty-load-overlay {
background-color: #333;
}
or customize it for every image:
<img ng-src="{{image.src}}"
pretty-load
pretty-load-width="{{image.width}}"
pretty-load-height="{{image.height}}"
pretty-load-color="{{image.color}}">
You have total control on how to handle the CSS transition from the overlay to the final image.
This CSS will give you the same results as the demo:
.pretty-load-overlay {
opacity: 0;
}
.pretty-load-loading .pretty-load-overlay {
opacity: 1;
transition: opacity 0.5s ease;
}
.pretty-load-completed .pretty-load-overlay {
opacity: 0;
transition: opacity 1.7s ease;
}
The directive wraps the image inside a div element. This container will have the following classes applied according to the state of the image inside:
.pretty-load-init: added when the directive is initialized.pretty-load-loading: added when the directive is initialized and removed when the image finishes loading.pretty-load-completed: added when the image finishes loadingThese are used in our example CSS and you can use them to control additional (for example, a spinner icon) or create more complex transitions between these states.
angular-pretty-load does not handle lazy loading. You would have to use an additional library for that.git checkout -b my-new-feature)git commit -am 'Add some feature')git push origin my-new-feature)Thank you contributors!
angular-pretty-load is maintained by platanus.
© 2015 Platanus, SpA. It is free software and may be redistributed under the terms specified in the LICENSE file.
FAQs
Angular Pretty Load directive ============
The npm package angular-pretty-load receives a total of 85 weekly downloads. As such, angular-pretty-load popularity was classified as not popular.
We found that angular-pretty-load demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.