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

ng-range-slider

v0.2.0

Published

Multi-handle range slider utilising the native HTML5 input range elements.

Downloads

81

Readme

ngRangeSlider

Travis   npm   License MIT   Experimental

ngRangeSlider is an experimental module for two reasons: it uses the input range element – and secondly, ngRangeSlider goes one step further to stack each input using special CSS selectors.

I created the module due to an observation on the limitation of input range elements – they are restricted to only one handle. Essentially ngRangeSlider is a HTML5 implementation of jQuery's range slider.


Getting Started

With ngRangeSlider the CSS is just as important as the JavaScript. Without the CSS the input range elements will still have a direct relationship, but they will not be stacked.

For the styles please refer to the Default.css document in the example, as this provides a fairly comprehensive list of the styles to be applied to the input range elements.

ngRangeSlider is a typical Angular directive which requires an ng-model attribute which it will write the range to in the form of { from: 0, to: 10 }.

<section data-range-slider ng-model="range"></section>

You're also able to apply the min, max, and step attributes – and these may also be changed after the directive has been initialised.

<section data-range-slider ng-model="range" min="minValue" max="maxValue"></section>

Each and every time the value of the range has been updated the ng-model will be updated. In our case using the example above it will write to $scope.range.

Current range is {{range.from}} to {{range.to}}!

Throttling

ngRangeSlider also supports the concept of event throttling. For example, when you're dragging the slider, the ng-model is updated with every change. However when you're implementing a feature such as fast filtering, you may wish to throttle the updating of ng-model to prevent excessive AJAX requests and/or WebSocket events. By specifying the throttle attribute in milliseconds you can achieve this:

<section data-range-slider ng-model="range" throttle="1500"></section>

In the above example, the ng-model will only be updated every 1,500 milliseconds. You need to have either Underscore.js or Lo-Dash installed.