Need maintainers
Due to my hectic schedule, it is getting hard to maintain this repository. If anybody is interested to work on this project, please give a pull request to fix some critical issues and enhancements.
ngx-image-gallery
Probably the best Angular 4+ modal and inline image gallery. Angular upgrade for ng-image-gallery.
Prerequisites
- Hammerjs (required for swipe)
npm i -S hammerjs lodash
Then import hammerjs into your project (tip: in you main.ts file), e.g:
import 'hammerjs';
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
document.addEventListener('DOMContentLoaded', () => {
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.log(err));
});
Install
npm install --save ngx-image-gallery
Import
;
Use
// app.component.html
Configure
;;
Interfaces
// gallery configuration // gallery image
All properties ending with
?
are optional.
Make gallery inline
You can make gallery inline like a carousel by setting conf.inline
to true
but make sure to change conf.backdropColor
as well if you need white backdrop color. Also width
and height
of the gallery can be adjusted by manually applying css styles with !important
flag on gallery element.
Dynamic Update
You can update gallery images images
and gallery configuration conf
anytime you want even when gallery is opened but due to Angular's change detection restrictions you must assign these variable to new value instead of changing internal properties as mentioned below.
// change imagesthis.images = this.images.concat; // change confthis.conf =;