Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ng-gallery

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng-gallery

Angular image gallery simplifies the process of creating beautiful image gallery for the web and mobile devices.

  • 1.0.0-beta.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
22K
increased by3.43%
Maintainers
1
Weekly downloads
 
Created
Source

Angular image gallery simplifies the process of creating beautiful image gallery for the web and mobile devices.

npm npm Travis branch npm npm

Installation

Install it with npm

npm install --save ng-gallery

SystemJS

If you are using SystemJS, you should also adjust your configuration to point to the UMD bundle.

In your systemjs config file, map needs to tell the System loader where to look for ng-gallery:

map: {
  'ng-gallery': 'node_modules/ng-gallery/bundles/ng-gallery.umd.js',
}

Usage

Import GalleryModule and set the gallery configuration in your root module

  import { BrowserAnimationsModule } from  '@angular/platform-browser/animations';
  import { GalleryModule } from 'ng-gallery';
  
  export const config : GalleryConfig = {
    // ...
  }
  
  @NgModule({
   imports: [
      // ...
      BrowserAnimationsModule,
      GalleryModule.forRoot(config)
   ]
  })

Basic

Add gallery in the template using the component <gallery></gallery>, see basic example

Lightbox

if you want to open the gallery in an overlay, use the service Gallery.open(), see gallery lightbox example

Finally, load the images and there are two options:

Load image

Use the service Gallery to load images

import { Gallery } from 'ng-gallery';

export class AppComponent implements OnInit {
  
  constructor(public gallery: Gallery) { }
  
  ngOnInit() {
    const images = [
      {
        src: 'assets/clouds.jpg',
        thumbnail: 'assets/clouds.jpg',
        text: 'Coulds'
      },
      // ...
    ];
    
    this.gallery.load(images);
  }
}

Auto-detect

Alternatively, you can load them automatically using [gallerize] directive, see auto-detect example

<div gallerize>
  <img src='assets/img/img3.jpg' alt='Spring'>
  <img src='assets/img/img4.jpg' alt='Fire'>
  <img src='assets/img/img5.jpg' alt='Peacock'>
</div>

Load images with specific class name

<div gallerize='cars'>
  <img class='cars' src='assets/img/img3.jpg' alt='BMW'>
  <img class='cars' src='assets/img/img4.jpg' alt='Toyota'>
  <img class='bikes' src='assets/img/img5.jpg' alt='S800'>
</div>

Gesture Support (optional)

Gallery Module relies on HammerJS for gestures, make sure it is loaded into the application.

You can add HammerJS to your application via npm, a CDN (such as the Google CDN), or served directly from your app.

To install via npm, use the following command:

$ npm install --save hammer.js

After installing, import it on your app's root module

import 'hammerjs';

Support

npm

Issues

If you identify any errors in this module, or have an idea for an improvement, please open an issue. I am excited to see what the community thinks of this project, and I would love your input!

Author

Murhaf Sousli

Keywords

FAQs

Package last updated on 31 Oct 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc