Adds src-retina
directive, for support retina-images.
If you want to use this plugin locally, install it by npm command:
npm install angular-src-retina
or
yarn add angular-src-retina
You can just add a script from CDN:
<script src="https://cdn.rawgit.com/dslpp056193/angular-src-retina/77ae3308/angular-src-retina.js"></script>
Don't forgot to add this module in your app:
var yourApp = angular.module('yourApp', [ /*...your modules...*/, 'src-retina']);
You can use src-retina
attribute for create retina-ready links.
Example:
<img src-retina="/path/to/img.png">
And if user's screen is retina, this img
tag will get attr src
with /path/to/[email protected]
.
Note: if /path/to/[email protected]
will not found, plugin will adds /path/to/img.png
But if user's screen is not retina, this img
tag will get /path/to/img.png
.
src-retina
attribute will removed after added src
attribute
Plugin will have configs in future.
- Add config with alternative postfix instead of "@2x"
I will pleased, if you will send pull-requests with a new functional or with fixes!
This work is licensed under The MIT License
You can help me and support this project with paypal or Bitcoin 33yhTK5BnKj6MZ3wf4GFEQgCtmWtqNwJHU