
Security News
NVD Quietly Sweeps 100K+ CVEs Into a “Deferred” Black Hole
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
ngx-image-viewer-3
Advanced tools
This package is an updated version of the ngx-image-viewer package for Angular17.
This package is an updated version of the ngx-image-viewer package for Angular17.
https://stackblitz.com/edit/stackblitz-starters-gzx4gb
To use default configuration, simply import the ImageViewerModule into your module, like so:
import { ImageViewerModule } from "ngx-image-viewer-3";
@NgModule({
//...
imports: [
//...
ImageViewerModule
],
//...
//You may receive the error "To allow any property add 'NO_ERRORS_SCHEMA'". In this case, add the following line.
schemas:[
NO_ERRORS_SCHEMA
]
})
Then, add the component to your template, providing an array of image URLs. You can also optionally add an index, to indicate which image should be shown first. The default will be the first item in the array.
<ngx-image-viewer [src]="images" [(index)]="imageIndex"></ngx-image-viewer>
By default, the image viewer will fill its container. If you wish to restrict the size, simply place it within a div, and set the size constraints on the div.
If you want to use the standard icons, you will also need to install font-awesome
npm install --save font-awesome
npm install --save-dev @types/screenfull
Otherwise, you will need to use the configuration to set different icon classes.
Configuration can be provided at the module level (at the component level, by passing it as the config
input. Any configuration provided at the component level will override that which is set at the module level.
The configuration object is structured as below. All values are optional, and if ommitted, the default value shown below will be used.
{
btnClass: 'default', // The CSS class(es) that will apply to the buttons
zoomFactor: 0.1, // The amount that the scale will be increased by
containerBackgroundColor: '#ccc', // The color to use for the background. This can provided in hex, or rgb(a).
wheelZoom: true, // If true, the mouse wheel can be used to zoom in
allowFullscreen: true, // If true, the fullscreen button will be shown, allowing the user to entr fullscreen mode
allowKeyboardNavigation: true, // If true, the left / right arrow keys can be used for navigation
btnIcons: { // The icon classes that will apply to the buttons. By default, font-awesome is used.
zoomIn: 'fa fa-plus',
zoomOut: 'fa fa-minus',
rotateClockwise: 'fa fa-repeat',
rotateCounterClockwise: 'fa fa-undo',
next: 'fa fa-arrow-right',
prev: 'fa fa-arrow-left',
fullscreen: 'fa fa-arrows-alt',
},
btnShow: {
zoomIn: true,
zoomOut: true,
rotateClockwise: true,
rotateCounterClockwise: true,
next: true,
prev: true
}
};
To add additional buttons use the following
<ngx-image-viewer [src]="images"
[config]="{customBtns:[{name: 'link', icon: 'fa fa-paperclip'}]}"
(customEvent)="handleEvent($event)">
</ngx-image-viewer>
handleEvent(event: CustomEvent) {
console.log(`${event.name} has been click on img ${event.imageIndex + 1}`);
switch (event.name) {
case 'print':
console.log('run print logic');
break;
}
}
Note: currently only 3 additional buttons is supported due to css
FAQs
This package is an updated version of the ngx-image-viewer package for Angular17.
The npm package ngx-image-viewer-3 receives a total of 178 weekly downloads. As such, ngx-image-viewer-3 popularity was classified as not popular.
We found that ngx-image-viewer-3 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
Research
Security News
Lazarus-linked threat actors expand their npm malware campaign with new RAT loaders, hex obfuscation, and over 5,600 downloads across 11 packages.
Security News
Safari 18.4 adds support for Iterator Helpers and two other TC39 JavaScript features, bringing full cross-browser coverage to key parts of the ECMAScript spec.