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

angular-number-picker

v2.2.0

Published

A directive used for picking number by using up/down button, instead of typing

Downloads

1,721

Readme

angular-number-picker

=====================

NPM version

A directive used for picking number by using -/+ button, instead of typing the number directly.

This is an angular directive designed in mobile-first concept. Which means you would have better user experience while in mobile development.

While running on mobile device, you would increase/decrease the number continuously by long tap the -/+ button.

Try it: plunker

Requirement

UI dependency(optional)

Installation

via bower

bower install angular-number-picker --save

via npm

npm install angular-number-picker --save

via script

<script type="text/javascript" src="node_modules/angular/angular.min.js"></script>
<script type="text/javascript" src="node_modules/angular-number-picker/dist/angular-number-picker.min.js"></script>

Import

via ES2015

import {ngNumberPicker} from 'angular-number-picker';

via CommonJS

var ngNumberPicker = require('angular-number-picker').ngNumberPicker;

via script

<script type="text/javascript">
    var ngNumberPicker = window.ngNumberPicker;
</script>

Basic Usage

Add ngNumberPicker module as your angular app's dependency

var demo = angular.module('demo', [ngNumberPicker]);

ngNumberPicker is the variable you get from above "Import" stage

Use h-number tag in your html

<div ng-controller="DemoController">
    <h-number value="input.num" min="2" max="10" step="1" change="onChanged()"></h-number>
</div>

You can use transclusion, too

<div ng-controller="DemoController">
    <h-number value="input.num" min="2" max="10" step="1" change="onChanged()">
        <input type="text" ng-model="input.num">
    </h-number>
</div>

Writing DemoController

demo.controller('DemoController', ['$scope', function($scope) {
   $scope.input = {
            num: 0
        };

   $scope.getNumber = function() {
       alert('The number is: [' + $scope.input.num + ']');
   };

   $scope.onChange = function(){
       console.log('The number is Changed ', $scope.input.num);
   };
}]);

h-number configuration

| Attribute | Type | Required | Description | | :------------- |:-------------| :-----:| :-----| | value | expression | Yes | Expression to evaluate as the input number | | min | Number | No | The minimal point to limit the operation. 0 by default | | max | Number | No | The maximum point to limit the operation. 100 by default | | step | Number | No | The step value for the operation. 1 by default| | singular | String | No | Label to be included after value when value is 1| | plural | String | No | Label to be included after value when value is not 1| | unit-position | String | No | where to place the singular/plural. Available options: left, right. right by default. | | change | Function | No | Function to be called while number is changed|

build-in class

input-group

The wrapper class for the h-number element

input-group-addon

The wrapper class for +- operator

form-control

The wrapper class for the number area at the center

active

The active class will be added to the input-group-addon button, while touching them. So it's possible to implement your own behavior.

picker-unit-left

The picker-unit-left class will be added to the left unit span

picker-unit-right

The picker-unit-right class will be added to the right unit span

It's easy to implement those classes to achieve your own UI

run demo locally

Install npm dependency

npm install

Install bower dependency

bower install

run demo

npm start

I will launch a debug server at http://localhost:8000/

LICENSE

MIT License