Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
ng-fallimg
Advanced tools
Readme
Set a default image when the main source on the image tag doesn't work
$ npm install ng-fallimg --save
import the NgFallimgModule module and use the static forRoot method in the root module (The forRoot method must be used in the root module), in other modules you only need to import NgFallimgModule without using the forRoot method to use the fallimg directive. Pass an object with the resources that you need.
Note: The default property is required, the forRoot method requires at least an object with a default property.
import { NgFallimgModule } from 'ng-fallimg';
@NgModule({
...
imports: [
BrowserModule,
NgFallimgModule.forRoot({
default: 'https://domain.com/mypicture.png',
picture1: 'assets/mypicture.png',
picture2: 'data:image/jpeg;base64, ... ',
})
],
...
})
export class AppModule { }
The object to pass to the forRoot method supports: local URLs, external URLs and base64.
once imported the NgFallimgModule module, you can use the fallimg directive on the img tags:
<img width="100px" src="http://domain.com/the/image/fails" fallimg>
When the main image (defined in the src property) fails and the fallimg property doesn't have a value, it gets the default resource ('https://domain.com/mypicture.png') defined in the object passed in the forRoot method
you can select the resource to load when the main image fails, defining the property's name:
<img width="100px" src="http://domain.com/the/image/fails" fallimg="picture1">
Now, when the main image fails, picture1 will be loaded ('assets/mypicture.png').
https://github.com/Lugriz/ng-fallimg
$ npm install
$ npm run test:lib
Enter to projects/ng-fallimg/src/lib and modify the library
$ npm run build:lib
Go to app.component.html and test your changes
FAQs
Set a default image when the main source on the image tag doesn't work
The npm package ng-fallimg receives a total of 37 weekly downloads. As such, ng-fallimg popularity was classified as not popular.
We found that ng-fallimg 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.