Git Product home page Git Product logo

angular2-set-class-in-view's Introduction

angular2-set-class-in-view

angular2-set-class-in-view is a plugin directive for Angular 2.

Setup


To use the Angular set class in view, simply run npm install angular2-set-class-in-view and then include SetClassInView in your project (see Example for more details).

Config / Example


Angular2 set class in view sets is able to set class on every element which appears in viewport of mobile or desktop browser.

import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppComponent }   from './app.component';
import { SetClassInView } from 'angular2-set-class-in-view/main';

@NgModule({
  imports: [ BrowserModule ],
  declarations: [
      AppComponent,
      SetClassInView
  ],
  bootstrap:    [ AppComponent ]
})
export class AppModule { }
<div [setClassInView]="'show'">
    <h3>This element is in view</h3>
    <img src="images/image.jpg" alt="image">
</div>

Config / Example


When you are using SystemJs you need to load angular2-set-class-in-view dependency

'angular2-set-class-in-view': {
        main: './main.js',
        defaultExtension: 'js'
      }

and map 'angular2-set-class-in-view to 'node_modules/angular2-set-class-in-view'.

Your systemjs.config.js could look like:

(function (global) {
  System.config({
    paths: {
      // paths serve as alias
      'npm:': 'node_modules/'
    },
    // map tells the System loader where to look for things
    map: {
      // our app is within the app folder
      app: 'app',
      '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
      'rxjs':                       'npm:rxjs',
      'angular2-in-memory-web-api': 'npm:angular2-in-memory-web-api',
      'angular2-set-class-in-view': 'npm:angular2-set-class-in-view'
    },
    // packages tells the System loader how to load when no filename and/or no extension
    packages: {
      app: {
        main: './main.js',
        defaultExtension: 'js'
      },
      rxjs: {
        defaultExtension: 'js'
      },
      'angular2-in-memory-web-api': {
        main: './index.js',
        defaultExtension: 'js'
      },
      'angular2-set-class-in-view': {
        main: './main.js',
        defaultExtension: 'js'
      }
    }
  });
})(this);

angular2-set-class-in-view's People

Contributors

robert197 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

d668

angular2-set-class-in-view's Issues

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.