An Angular responsive image full screen viewer. Also support youtube and mp4 video urls, captures swipes from phones and tablets, Compatible with Angular Universal, Captures keyboard next/previous arrow.
npm install ng-image-fullscreen-viewAn Angular responsive image fullscreen viewer.
Also support youtube and mp4 video urls.
(Compatible with Angular Version: 11)
- Responsive
- captures swipes from phones and tablets
- Compatible with Angular Universal
- captures keyboard next/previous arrow key event for lightbox image move
- Support Images (jpeg, jpg, gif, png and Base64-String), Youtube url and MP4 video (url and Base64-String)
npm install ng-image-fullscreen-viewImport module in your app.module.ts:
``typescript
import { NgImageFullscreenViewModule } from 'ng-image-fullscreen-view';
...
@NgModule({
declarations: [
AppComponent
],
imports: [
NgImageFullscreenViewModule,
...
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {
}
`
Add component in your template file :
`html
[imageIndex]="selectedImageIndex"
[show]="showFlag"
(close)="closeEventHandler()">
`
Add closeEventHanler and showFlag conditions in your.component.ts :
`typescript
export class AppComponent {
showFlag: boolean = false;
selectedImageIndex: number = -1;
constructor () {}
...
showLightbox(index) {
this.selectedImageIndex = index;
this.showFlag = true;
}
closeEventHandler() {
this.showFlag = false;
this.currentIndex = -1;
}
...
}
`
ImageObject format
`js`
imageObject: Array
Image, Youtube and MP4 url's object format
`js`
imageObject: Array
| Name | Type | Data Type | Description | Default |
|------|------|-----------|-------------|---------|
| images | @Input | Array | Images array. | |
| imageIndex | @Input | number | Selected image index. | 0 |
| show | @Input | boolean | Image fullscreen popup visiable flag. | false |
| infinite | @Input | boolean | Infinite sliding images if value is true. | false |
| videoAutoPlay | @Input | boolean | Auto play popup video | false |
| showVideoControls | @Input | boolean | Hide Youtube and MP4 video controls if value is false | true |false` | true |
| direction | @Input | string | Set text direction. You can pass rtl / ltr / auto | ltr |
| paginationShow | @Input | boolean | Display pagination at bottom. | false |
| animationSpeed | @Input | number | By this user can set slider animation speed. Minimum value is 0.1 second and Maximum value is 5 second. | 1 |
| arrowKeyMove | @Input | boolean | Disable slider and popup image left/right move on arrow key press event, if value is
| close | @Output | n/a | Executes when click on close. | n/a |
| prevImage | @Output | n/a | Executes when click on previous arrow. | n/a |
| nextImage | @Output | n/a | Executes when click on next arrow. | n/a |
Your contributions and suggestions are always welcome :)