angular-background-img
v1.1.2
Published
A tiny (420 bytes) directive for dynamically setting an element's CSS background image.
Downloads
13
Readme
angular-background-image
A tiny (420 bytes) angular directive for dynamically setting an element's CSS background image.
Installation
Fetch from npm.
$ npm install angular-background-img
Add to your HTML (or build script or whatever). Remember to load it after angular itself.
<script type="text/javascript" src="./node_modules/angular/angular.min.js"></script>
<script type="text/javascript" src="./node_modules/angular-background-img/angular-background-img.min.js"></script>
Add to your app's dependency array
angular
.module('my-module', [
'sb-background-image'
]);
Usage
<element sb-background-image="./cats.jpg"></element>
Result
<element style="background-image: url(./cats.jpg);"></element>
Build
To build the app, run npm run build
.
License
MIT
Copyright 2016 Sindre Bøyum