
Research
Security News
The Landscape of Malicious Open Source Packages: 2025 Mid‑Year Threat Report
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
ng-image-gallery
Advanced tools
Probably the best angular inline and modal image gallery combined...
Angular directive for image gallery in modal with thumbnails or inline like carousel
https://github.com/thatisuday/ngx-image-gallery
Make sure you load all dependencies before loading ng-image-gallery files
bower install --save ng-image-gallery
npm install --save ng-image-gallery
Include
angular.min.js
andangular-animate.min.js
from bower components.Include
ng-image-gallery.min.js
andng-image-gallery.min.css
fromdist
folder of this repository.Include
icons
fromres
folder of this repository.Include
hammer.js
for touch support (optional).
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular-animate.js"></script>
ng-image-gallery.min.js
and ng-image-gallery.min.css
from dist
folder of this repository.icons
from res
folder of this repository.hammer.js
from http://hammerjs.github.io (optional).Add thatisuday.ng-image-gallery
module to your app's dependencies.
var myTestApp = angular.module('test', ['thatisuday.ng-image-gallery']);
<ng-image-gallery
images="images"
methods="methods"
thumbnails="true | false | boolean-model"
thumb-size="integer | model"
inline="true | false | boolean-model"
bubbles="true | false | boolean-model"
bubble-size="integer | model"
img-bubbles="true | false | boolean-model"
bg-close="true | false | boolean-model"
piracy="true | false | boolean-model"
img-anim="fadeup"
conf="conf"
on-open="opened();"
on-close="closed();"
on-delete="delete(img, cb)"
></ng-image-gallery>
You can also use
<div ng-image-gallery ...></div>
approach.
config
phaseYou can set up ng-image-gallery
options once and for all using ngImageGalleryOptsProvider
.
myApp.config(['ngImageGalleryOptsProvider', function(ngImageGalleryOptsProvider){
ngImageGalleryOptsProvider.setOpts({
thumbnails : true,
thumbSize : 80,
inline : false,
bubbles : true,
bubbleSize : 20,
imgBubbles : false,
bgClose : false,
piracy : false,
imgAnim : 'fadeup',
});
}])
See runtime options for explanation
images is a JavaScript array that contains objects with image url(s) of the images to be loaded into the gallery. This object can be dynamic, means images can be pushed into this array at any time. This array looks like below...
// inside your app controller
$scope.images = [
{
id : 1,
title : 'This is <b>amazing photo</b> of <i>nature</i>',
alt : 'amazing nature photo',
thumbUrl : 'https://pixabay.com/static/uploads/photo/2016/06/13/07/32/cactus-1453793__340.jpg',
url : 'https://pixabay.com/static/uploads/photo/2016/06/13/07/32/cactus-1453793_960_720.jpg',
extUrl : 'http://mywebsitecpm/photo/1453793'
},
{
id : 2,
url : 'https://pixabay.com/static/uploads/photo/2016/06/10/22/25/ortler-1449018_960_720.jpg',
deletable : true,
},
{
id : 3,
thumbUrl : 'https://pixabay.com/static/uploads/photo/2016/04/11/18/53/aviator-1322701__340.jpg',
url : 'https://pixabay.com/static/uploads/photo/2016/04/11/18/53/aviator-1322701_960_720.jpg'
}
];
id
is unique field which is mandatory after v2.1.0. This help angular keep track of images.
deletable
is boolean field which provide delete icon on gallery to delete the image. Readon-delete
attribute.
thumbUrl
is not absolutely necessary. IfthumbUrl
url is empty, thumbnail will useurl
instead to show preview.
extUrl
is also optional, it is external link of current image. An `external link' icon with anchor link will be added beside close button.
title
andalt
tags are also optional.
--
methods is a communication gateway between your app and image gallery methods. It's a JavaScript object which can be used to open
or close
the modal as well as change images inside gallery using prev
and next
key. This can be done as follows...
// inside your app controller
$scope.images = [...];
// gallery methods
$scope.methods = {};
// so you will bind openGallery method to a button on page
// to open this gallery like ng-click="openGallery();"
$scope.openGallery = function(){
$scope.methods.open();
// You can also open gallery model with visible image index
// Image at that index will be shown when gallery modal opens
//scope.methods.open(index);
};
// Similar to above function
$scope.closeGallery = function(){
$scope.methods.close();
};
$scope.nextImg = function(){
$scope.methods.next();
};
$scope.prevImg = function(){
$scope.methods.prev();
};
--
thumbnails attribute is used when you need to generate thumbnails on the page of the gallery images. When user clicks on any thumbnail, gallery modal is opened with that image as visible image.
--
Sets the size of thumbnails in pixels. You just need to add integer values.
--
inline attribute is used when you need to inline image gallery instead in modal. When gallery is inline, no thumbnails will be generated and gallery will be launched automatically.
--
Turn on/off bubbles.
--
Sets the size of navigational bubbles in pixels. You just need to add integer values.
--
To create image bubbles instead of simple circles. by default, bubble image url will be thumbUrl
or url
. But you can also add bubbleUrl
(of small sizes images) to minimize request payload.
Not recommend if bubbles url defaults to
url
as it will download heavy images all at once.
--
close gallery on background click. This can be very sensitivity in mobile devices. This will not work in inline gallery.
--
Allow user to save image by right click on it.
--
Set animation for image transition. Possible animation classes : fade
, fadeup
, zoom
, slide
, pop
, revolve
.
--
conf
attribute contains JavaScript object (bound to scope) which override global options.
Not a big fan of inline options, use conf
$scope.conf = {
thumbnails : true,
thumbSize : 80,
inline : false,
bubbles : true,
bubbleSize : 20,
imgBubbles : false,
bgClose : false,
piracy : false,
imgAnim : 'fadeup',
};
--
This is the callback function that must be executed after gallery modal is opened. Function in the controller will look like below
$scope.opened = function(){
alert('Gallery opened'); // or do something else
}
--
Similar to on-open
attribute but will be called when gallery modal closes.
--
Callback function when user deletes the image. This function receives two arguments. The image that is requested to delete and a callback function. Once you dealt with image, make sire to call callback function, which will remove that image from gallery and refresh the UI.
Touch will be enabled only if
hammer.js
file is added.
.ng-image-gallery-modal
class inside .ng-image-gallery.inline
class.open
and close
events.You can build this directive with your own customization using gulp.
npm install --dev
.npm install -g gulp
to install gulp globally.gulp build
or gulp watch
node demo-server.js
to lauch demo of the plugin.FAQs
Probably the best angular inline and modal image gallery combined...
The npm package ng-image-gallery receives a total of 0 weekly downloads. As such, ng-image-gallery popularity was classified as not popular.
We found that ng-image-gallery 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.
Research
Security News
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.