Skip to content

Commit

Permalink
fix 0.1.1 miss the dist folder
Browse files Browse the repository at this point in the history
  • Loading branch information
stiekel committed Dec 29, 2015
1 parent 9b8ce22 commit c5c4614
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions dist/angular-image-404.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ angular.module('angular-image-404', [])
restrict: 'A',
link: function(scope, element, attributes){
var notFoundCount = 0;
element.on('error', function(){
if(!attributes.src) {
changeSCR();
}
element.on('error', changeSCR);
function changeSCR(){
var newIamgeUrl = attributes.angular404;
if(notFoundCount >= 3 || !newIamgeUrl) {
newIamgeUrl = getDefaultImagePlaceholder();
}
element.attr('src', newIamgeUrl);
notFoundCount++;
});

}
function getDefaultImagePlaceholder() {
var width = element[0].offsetWidth || 120;
var height = element[0].offsetHeight || 120;
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-image-404.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-image-404",
"version": "0.1.1",
"version": "0.1.2",
"description": "AngualrJS directive that shows a fallback image when img element can not show picture correct",
"main": "gulpfile.js",
"directories": {
Expand Down

0 comments on commit c5c4614

Please sign in to comment.