Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ng2-img-fallback

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng2-img-fallback

Angular2 directive for image fallback

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
81
increased by50%
Maintainers
1
Weekly downloads
 
Created
Source

Angular2 Image Fallback npm version Bower version Dependencies

Load placeholder image on image error

Angular 2 directive that loads placeholder image on primary image error.

Demo page

Install

NPM:

npm install  ng2-img-fallback --save

or Bower:

bower install ng2-img-fallback --save

Usage

In case you're using SystemJS see configuration here

Add directive to your module's declarations

import { NgModule } from '@angular/core';
import { BrowserModule  } from '@angular/platform-browser';
import { AppComponent } from './app';
 
import { Ng2ImgFallback } from 'ng2-img-fallback';
 

@NgModule({
  imports: [BrowserModule, Ng2ImgFallback],
  declarations: [AppComponent],
  bootstrap: [AppComponent]
})
export class AppModule {}

Use it in you component

import { Component } from '@angular/core';

@Component({
  selector: 'example-app',
  template: '<img src="some_img.png" src-fallback="{{ placeholder }}" >'
})
export class AppComponent {
  placeholder = 'http://placehold.it/200x200';
}

See also example or demo page

License

MIT © Vadym Yatsyuk

Keywords

FAQs

Package last updated on 27 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc