Gathering detailed insights and metrics for ng2-file-viewer
Gathering detailed insights and metrics for ng2-file-viewer
Gathering detailed insights and metrics for ng2-file-viewer
Gathering detailed insights and metrics for ng2-file-viewer
npm install ng2-file-viewer
Typescript
Module System
Node Version
NPM Version
Total Downloads
2,952
Last Day
1
Last Week
6
Last Month
21
Last Year
300
Minified
Minified + Gzipped
Latest Version
1.1.1
Package Id
ng2-file-viewer@1.1.1
Unpacked Size
95.39 kB
Size
13.20 kB
File Count
9
NPM Version
6.14.6
Node Version
10.22.1
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
20%
6
Compared to previous week
Last Month
61.5%
21
Compared to previous month
Last Year
-79.2%
300
Compared to previous year
4
This component uses the Image Viewer JS in it's core.
Ng2-Image Viewer uses MIT license, so you can use it as you wish, feel free to help contributing with the code.
This component allows you to:
Take a look at this quick tutorial!
You can donate on my Patreon!
The component already have some input references:
Name | Type | Required | Default Value | Description |
idContainer | string | X | NULL | It is the id of the component on the HTML, this parameter allows you to inject as many components as you wish. |
images | BASE64/URL[] | NULL | It is the array containing the base64 data, the component differs the images and the PDF files, so don't worry. | |
defaultDownloadName | string | 'Image' | It is the default name used on the file to be downloaded, Ex: Image 1, Image 2 | |
rotate | boolean | true | It is the boolean that renders the rotate left and right buttons | |
resetZoom | boolean | true | It is the boolean that renders the resetZoom button | |
zoomInButton | boolean | true | It is the boolean that renders the Zoom In Button | |
zoomOutButton | boolean | true | It is the boolean that renders the Zoom Out Button | |
zoomInTooltipLabel | string | Zoom In | It is the tooltip value you want for the zoom in button | |
zoomOutTooltipLabel | string | Zoom Out | It is the tooltip value you want for the zoom out button | |
download | boolean | true | It is the boolean that renders the download button | |
fullscreen | boolean | true | It is the boolean that renders the fullscreen button | |
showOptions | boolean | true | It is the boolean that renders the options panel at the top right corner | |
showPDFOnlyOption | boolean | true | It is the boolean that renders the PDF only button | |
loadOnInit | boolean | false | It is the boolean that lets you choose if you want to load the component on the OnInit event or on the OnChanges event, It was created because i faced some trouble with the primeNG tab using the change event. | |
primaryColor | string | '#0176bd' | It is the background-color used on the footer and on the options panel | |
buttonsColor | string | 'white' | It is the color used on the buttons on the options panel | |
buttonsHover | string | '#333333' | It is the color used on the hover event, when the button receive the mouse pointer | |
enableTooltip | boolean | true | It is the boolean that renders the tooltips above the buttons | |
rotateRightTooltipLabel | string | 'Rotate right' | It is the tooltip value you want for the rotate right button | |
rotateLeftTooltipLabel | string | 'Rotate left' | It is the tooltip value you want for the rotate left button | |
resetZoomTooltipLabel | string | 'Reset zoom' | It is the tooltip value you want for the reset zoom button | |
fullscreenTooltipLabel | string | 'Fullscreen' | It is the tooltip value you want for the fullscreen button | |
downloadTooltipLabel | string | 'Download' | It is the tooltip value you want for the download button | |
showPDFOnlyLabel | string | 'Show only PDF' | It is the tooltip value you want for the show PDF only button | |
openInNewTabTooltipLabel | string | 'Open in new tab' | It is the tooltip value you want for the open in new tab button | |
onNext | EventEmitter | It is the event triggered when you change to next file, it emits the actual index of the array on the component | ||
onPrevious | EventEmitter | It is the event triggered when you change to previous file, it emits the actual index of the array on the component |
To install this library, run:
1$ npm install iv-viewer --save 2$ npm install ng2-image-viewer --save
And then from your Angular AppModule
:
1import { BrowserModule } from '@angular/platform-browser'; 2import { NgModule } from '@angular/core'; 3 4import { AppComponent } from './app.component'; 5 6// Import your library 7import { ImageViewerModule } from 'ng2-image-viewer'; 8 9@NgModule({ 10 declarations: [ 11 AppComponent 12 ], 13 imports: [ 14 BrowserModule, 15 16 // Specify your library as an import 17 ImageViewerModule 18 ], 19 providers: [], 20 bootstrap: [AppComponent] 21}) 22export class AppModule { }
Now just add the these codes on your angular-cli.json file:
1"styles": [ 2 "../node_modules/ng2-image-viewer/imageviewer.scss" 3],
Once your library is imported, you can use its components, directives and pipes in your Angular application:
1<!-- You can now use your library component in app.component.html --> 2<h1> 3 Image Viewer 4</h1> 5<app-image-viewer [images]="['iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==', 'https://picsum.photos/900/500/?random']" 6[idContainer]="'idOnHTML'" 7[loadOnInit]="true"></app-image-viewer>
To generate all *.js
, *.d.ts
and *.metadata.json
files:
1$ npm run build
To lint all *.ts
files:
1$ npm run lint
MIT © brenoprata10
No vulnerabilities found.
No security vulnerabilities found.