JSPM

ng-scrolling

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q11976F
  • License MIT

Scroll to element library for agnualr 6+

Package Exports

  • ng-scrolling

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ng-scrolling) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ng-scrolling-to-el

Demo

https://MarcinMichalik.github.io/ng-scrollTo/

Table of contents

About

Simple scrollTo directive for Angular 2+. You can use it to scroll to element on your website.

Installation

Install through npm:

npm install --save ng-scrolling-to-el

@DarthFarzad pull request (not yet merged)

npm install --save ng-scrolling-to-el@next

Then include in your apps module:

import { Component, NgModule } from '@angular/core';
import { ScrollToModule } from 'ng-scrolling-to-el';

@NgModule({
  imports: [
    ScrollToModule.forRoot()
  ]
})
export class MyModule {}

Usage

scrollDuration and scrollOffset is optional parameters.

Directive

<button class="btn btn-primary" [scrollTo]="'#place1'" [scrollDuration]="1000" [scrollOffset]="-100">Place 1</button>
<button class="btn btn-primary" [scrollTo]="place2">Place 2</button>
<div id="place1"></div>
<div #place2></div>

You may also find it useful to view the demo source.

Service

<div class="card mt-5" #top></div>
<button class="btn btn-primary" (click)="scrollToTop(top)">Top</button>

You may also find it useful to view the demo source.

import { ScrollToService } from 'ng-scrolling-to-el';

export class DemoComponent {

    constructor(private scrollService: ScrollToService) {}

    scrollToTop(element) {
        this.scrollService.scrollTo(element);
    }
}

You may also find it useful to view the demo source.

Documentation

All documentation is auto-generated from the source via compodoc and can be viewed here: https://MarcinMichalik.github.io/ng-scrollTo/docs/

Development

Prepare your environment

  • Install Node.js and NPM
  • Install local dev dependencies: npm install while current directory is this repo

Development server

Run npm start to start a development server on port 8000 with auto reload + tests.

Testing

Run npm test to run tests once or npm run test:watch to continually run tests.

Release

  • Bump the version in package.json (once the module hits 1.0 this will become automatic)
npm run release

License

MIT