ng-fallback-src
replace 404s with some default asset, for better [empty] states.
Install
npm install --save ng-fallback-src bower install --save ng-fallback-src
Example Usage
This was originally meant for img
tags only, but theoretically it could work for any element with a src
tag. This theory is untested so use at your own risk.
Note: if someFlakyVar
can be falsy, you'll need to account for it separately, e.g.
since most browsers won't actually fire the error event if the src
is empty.
Contributing
The most obvious things right now are
- tests
- adding files so this can be published to other package managers.
-
Create your feature branch:
git checkout -b my-new-feature
-
Commit your changes:
git commit -am 'Add some feature'
-
Push to the branch:
git push origin my-new-feature
-
Create a new Pull Request
Credits
- @concertcoder [Chris Gosselin]: version
0.x
and helping correct a potential memory leak - @nexus-uw [Simon Ramsay]: pointing out that @concertcoder wrote this once upon a time