npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ngx-stepwise

v0.2.1

Published

"Dumb" because it has only two commands: _next_ and _prev_ for navigation.

Downloads

3

Readme

Dumb-pagination for angular ^2.x apps

"Dumb" because it has only two commands: next and prev for navigation.

May be useful for UI components like complex forms, side-bars etc.

Prerequisites

  • Node v6.x and higher
  • Angular 2.x and higher
  • TypeScript
  • RxJS

Installation

npm install ngx-stepwise --save

Setup

Angular-seed

/**
 * System configuration for Angular 2 samples
 * Adjust as necessary for your application needs.
 */
(function(global) {
  // map tells the System loader where to look for things
  var map = {
    '@angular'    : 'node_modules/@angular',
    'rxjs'        : 'node_modules/rxjs',
    'ngx-stepwise': 'node_modules/ngx-stepwise/dist/ngx-stepwise.umd.js'
  };

  // packages tells the System loader how to load when no filename and/or no extension
  var packages = {
    'app' : { main: 'dist/main.js',  defaultExtension: 'js' },
    'rxjs': { defaultExtension: 'js' }
  };

  var ngPackageNames = [
    'common',
    'compiler',
    'core',
    'forms',
    'http',
    'platform-browser',
    'platform-browser-dynamic',
    'router'
  ];

  var config = {
    map: map,
    packages: packages
  };

  System.config(config);
})(this);

Angular CLI

After installing use it as usual with others modules in your ng-cli projects

Usage

Import StepwiseModule module into root or feature module:

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

import { AppComponent } from './app.component';
import { StepwiseModule  } from 'ngx-stepwise';

@NgModule({
  declarations: [ AppComponent ],
  imports: [
    BrowserModule,
    StepwiseModule
  ],
  bootstrap: [ AppComponent ]
})
export class AppModule { }

The main functionality belongs to only 4 directives: stepwise-container, stepwise-step, stepwiseNext and stepwisePrev

Those should be nested in the following order: container > step > next/prev

You can attach stepwise-container and stepwise-step to any html element.

stepwise-container directive has pageChange output property that emits current page.

Both stepwiseNext and stepwisePrev have optional input property which may be usefull for disabling controls. Preferably those should be used for main html controls such as buttons.

Example

app.component.html:

<div stepwise-container (pageChange)="handlePageChange($event)">

  <h2>Current page: {{ currentPage }}</h2>

  <div stepwise-step>
    <h1>Step 1</h1>
    <button stepwiseNext>Next</button>
  </div>

  <div stepwise-step>
    <h1>Step 2</h1>
    <!-- [stepwiseNext]="false" indicates that the control will be disabled -->
    <button [stepwiseNext]="false">Next</button>
    <button stepwisePrev>Prev</button>
  </div>

  <div stepwise-step>
    <h1>Step 3</h1>
    <button [stepwisePrev]="true">Prev</button>
  </div>

</div>

app.component.ts:

import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class AppComponent implements OnInit {
  public currentPage: number;

  public ngOnInit() {
    this.currentPage = 0;
  }

  public handlePageChange(page) {
    this.currentPage = page;
  }
}

Built with

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Igor Lee embarq - Initial work

License

This project is licensed under the MIT License - see the LICENSE.md file for details