0.0.6 • Published 10 years ago

angular-tidy-img v0.0.6

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

NPM

angular-tidy-img

A small AngularJS directive that makes working with images a breeze.

todo example

tidy-img lets you pass in a "loader", which will be shown while your image is being loaded. It also lets you specify a fallback image url in case your image isn't found.

Install

Install with NPM npm install --save angular-tidy-img

Or, install with Bower bower install --save angular-tidy-img

Now, declare tidy-img as a dependency.

var app = angular.module( 'MyApp', [ 'rc.tidyImg' ] );

Usage

In your templates, apply the tidy-img directive as an element or an attribute

<tidy-img
    img-src="your/image/path/or/url.png"
    img-width="100px" 
    img-height="100px" 
    loader="<img src='my/preloader/spinner.gif'>" 
    fallbackSrc="fallback/image/in/case/of/error.png" 
></tidy-img>

API

AttributeInfo
imgSrcstring required - url or path to your desired image
imgWidthstring optional - dimensional unit, if you don't specify this, you'll want to add your own CSS styles or the image will not be the right size
imgHeightstring optional - dimensional unit, if you don't specify this, you'll want to add your own CSS styles or the image will not be the right size
loaderstring optional - HTML markup (not an actual element reference), for example <b class="loader">Loading...</b>
fallbackSrcstring optional - url or path to fallback image in case we couldn't load the intended image

NOTE

  • You should apply your own styles to this directive.
  • All of the attributes accept interpolated variables.
  • If don't pass in a width or height, then your image container might now be visible since it has 0x0px dimensions.
  • Changes in your model will not have any effect yet, will get to this soon.

TODO

  • Demo with different usage cases.
  • Use $observe on img-src attribute to apply model changes.
0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago