npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

angular-touchspin

1.0.0 • Public • Published

Angular Touchspin

Build Status Code Climate Test Coverage 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', ['angular-touchspin']).
  3. Create an element to hold the editor and add an ng-model="htmlVariable" attribute where htmlVariable is the scope variable that will hold the HTML entered into the editor:
<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.

install

npm i angular-touchspin

Downloadsweekly downloads

179

version

1.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability