Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
ng2-img-fallback
Advanced tools
Load placeholder image on image error
Angular 2 directive that loads placeholder image on primary image error.
NPM:
npm install ng2-img-fallback --save
or Bower:
bower install ng2-img-fallback --save
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';
}
0.2.0
Now instead of declaring Ng2ImgFallback
you need to import it:
@NgModule({
imports: [BrowserModule, Ng2ImgFallback],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
FAQs
Angular2 directive for image fallback
The npm package ng2-img-fallback receives a total of 74 weekly downloads. As such, ng2-img-fallback popularity was classified as not popular.
We found that ng2-img-fallback demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.