Code Monkey home page Code Monkey logo

angular2-image-gallery's Introduction

Angular Image Gallery

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',
}

Here is a live plunkr

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 galleryConfig : GalleryConfig = {
    // ...
  }
  
  @NgModule({
   imports: [
      // ...
      BrowserAnimationsModule,
      GalleryModule.forRoot(galleryConfig)
   ]
  })

After that you will be able to use Gallery's components and there is two options:

  • <gallery></gallery> : to insert the gallery right in the template, see basic example
  • <gallery-modal></gallery-modal> : to open the gallery in a modal, see modal example

One final step is to fill the gallery with images and there is two options:

  • Using GalleryService
constructor(private gallery: GalleryService) { }

ngOnInit() {
    this.gallery.load(images);
}
  • Using [gallerize] directive
<div [gallerize] class="content">
    <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>

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';

Author

Murhaf Sousli

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!

angular2-image-gallery's People

Contributors

murhafsousli avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.