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-touchspin

v2.0.0

Published

A input spinner component for Bootstrap 3 and angular

Downloads

133

Readme

Angular Touchspin

License NPM Release NPM Monthly Downloads

angular-touchspin is a port of istvan-ujjmeszaros/bootstrap-touchspin. It could now show some differences with it.

The goal is to provide the same API than the original one but without jQuery and using all the angular power.

Requirements

  1. AngularJS1.4.x
  2. Bootstrap3.x for the default styles (Can use bootstrap-css-only, you must add this to your bower or include this manually)
  3. NOTE: please check the requirements for earlier releases, if these are an issue.

Where to get it

Via Bower:

Run bower install angular-touchspin from the command line. Include script tags similar to the following:

<link rel='stylesheet' href='/bower_components/angular-touchspin/dist/angular-touchspin.css'>
<script src='/bower_components/angular-touchspin/dist/angular-touchspin.min.js'></script>

Via NPM:

Run npm install angular-touchspin from the command line. Include script tags similar to the following:

<link rel='stylesheet' href='/node_modules/angular-touchspin/dist/angular-touchspin.css'>
<script src='/node_modules/angular-touchspin/dist/angular-touchspin.min.js'></script>

Install using commonjs (eg componentjs, Webpack, Browserify):

angular.module('myModule', [require('angular-touchspin')]);

For CSS support with Webpack, install the style-loader, css-loader (and postcss-loader) and configure the loader in your webpack.config.js similar to the following:

loaders: [
  {test: /\.css$/, loader: 'style!css!postcss'}
]

Via Github

Download the code from https://github.com/nkovacic/angular-touchspin/releases/latest, unzip the files then add script tags similar to the following:

<link rel='stylesheet' href='/path/to/unzipped/files/dist/angular-touchspin.min.css'>
<script src='/path/to/unzipped/files/dist/angular-touchspin.min.js'></script>

Usage

  1. Include angular-touchspin.min.js
  2. Add a dependency to angular-touchspin in your app module, for example: angular.module('myModule', ['nk.touchspin']).
  3. Create an element to hold the control and add an ng-model="numberVariable" attribute where numberVariable is the scope variable that will hold the selected number value:
<div touch-spin ng-model="numberVariable"></div>

OR

<touch-spin ng-model="numberVariable"></touch-spin>

This acts similar to a regular AngularJS / form input if you give it a name attribute, allowing for form submission and AngularJS form validation.

Options

angular-touchspin can be configured using an options attribute options="optionsVariable" where optionsVariable is the scope variable that will hold options for the touchspin control.

<div touch-spin ng-model="numberVariable" options="optionsVariable"></div>

OR

<touch-spin ng-model="numberVariable" options="optionsVariable"></touch-spin>

Available options:

interface ITouchSpinOptions {
	buttonDownClass?: string;	
	buttonDownShow?: boolean;	
	buttonDownTxt?: string;
	buttonUpClass?: string;
	buttonUpShow?: boolean;
	buttonUpTxt?: string;
	min?: number;
	max?: number;
	step?: number;
	decimals?: number;
	decimalsDelimiter?: string;
	stepInterval?: number;
	forceStepDivisibility?: string; // none | floor | round | ceil
	inputReadOnly?: boolean;
	stepIntervalDelay?: number;
	verticalButtons?: boolean;
	verticalUpClass?: string;
	verticalDownClass?: string;
	prefix?: string;
	postfix?: string;
	prefixExtraClass?: string;
	postfixExtraClass?: string;
	mousewheel?: boolean;
}

It also supports min and max attributes for validating input value range (useful if the default value is not preffered).

<touch-spin ng-model="numberVariable" min="minValue" max="maxValue"></touch-spin>

Callback

angular-touchspin supports callback on model change using an attribute on-change="valueChanged(value,oldValue)" where valueChanged is the scope function that will be called on change.

<div touch-spin ng-model="numberVariable" options="optionsVariable" on-change="valueChanged(value,oldValue)"></div>

OR

<touch-spin ng-model="numberVariable" options="optionsVariable" on-change="valueChanged(value,oldValue)"></touch-spin>