# angular-fallback-image

> Angular directive that shows a fallback image when an image returns 404

Latest version **1.2.0** (published 2016-02-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install angular-fallback-image
pnpm add angular-fallback-image
yarn add angular-fallback-image
bun add angular-fallback-image
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2016-02-12 |
| First published | 2015-05-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+10 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 12 |
| Author | Sebastian Rodriguez |
| Maintainers | sebasrodriguez |
| Keywords | angular, directive, image, fallback |

## Links

- npm: https://www.npmjs.com/package/angular-fallback-image
- Repository: https://github.com/sebasrodriguez/angular-fallback-image
- Issues: https://github.com/sebasrodriguez/angular-fallback-image/issues
- npm.io page: https://npm.io/package/angular-fallback-image

## Dependencies (1)

- [angular](https://npm.io/package/angular.md) ^1.2.0

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2016-02-12
- 1.1.1 — 2015-11-13
- 1.0.0 — 2015-05-12

## README

[![Bower version](https://badge.fury.io/bo/angular-fallback-image.svg)](http://badge.fury.io/bo/angular-fallback-image)
[![npm version](https://badge.fury.io/js/angular-fallback-image.svg)](http://badge.fury.io/js/angular-fallback-image)

# angular-fallback-image
Angular directive that shows a fallback image when an image returns 404

## How to use it

You must include the angular-fallback-image dependency on your angular module:
```javascript
var app = angular.module("exampleApp", ["angular-fallback-image"]);
```

Then on your html you simply use it like this:
```html
<img ng-src="nonExistentImage.png" sr-fallback="fallback.png" /> 
```

Angular expressions can also be added to the sr-fallback attribute.

If you do not want to set your custom fallback image, you can use default, angular-fallback-image will get a image from [placeholder.it](https://placehold.it/):
```html
<img ng-src="{{example.Image}}" sr-fallback width=350 height=150 />
```

If you do not set width or height of `img`, angular-fallback-image will get the element width and height.

---
_Source: https://npm.io/package/angular-fallback-image · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
