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-incremental-list

v0.4.3

Published

List that auto-increments and decrements

Downloads

45

Readme

angular-incremental-list

npm version bower version build status

List that auto-increments and decrements depending on the changes of the items in the list.

Requirements

Load into your app

You can get it from Bower

bower install angular-incremental-list

Load the script files in your application:

<script type="text/javascript" src="bower_components/angular/angular.js"></script>
<script type="text/javascript" src="bower_components/angular-incremental-list/angular-incremental-list.js"></script>

Add the specific module to your dependencies:

angular.module('myApp', ['incrementalList', ...])

Usage examples

Live demo

<!-- Basic example -->
<ul>
  <li ng-repeat="item in list" il-list="list">
    <input type="text" ng-model="item.name" il-item-model>
  </li>
</ul>
<!-- -->
<!-- ilIncreaseOn example -->
<!-- First and last name are required, but age is optional -->
<ul>
  <li ng-repeat="person in list" il-list="list" il-increase-on="person.firstName && person.lastName">
    <input type="text" ng-model="person.firstName" il-item-model required>
    <input type="text" ng-model="person.lastName" il-item-model required>
    <input type="number" ng-model="person.age" il-item-model>
  </li>
</ul>
<ul>

Directives

  • ilList: Indicates the list that will auto-increment or decrement. Used in conjunction with ngRepeat. All the other directives require this one.
  • ilItemModel: Notify of changes on the list. Requires ngModel directive.
  • ilNewItem: The item that is pushed to the list when it is increased. It is evaluated with the scope of the last item. Default: {}.
  • ilIncreaseOn: The conditions that must be met to increase the list. It is evaluated with the scope of the last item. Default: the changed input must be truthy or 0.
  • ilDecreaseOn: The conditions that must be met to decrease the list. It is evaluated with the scope of the last and the second to last item. Default: all inputs must be empty.
  • ilListModel: This is used when there are nested ilList. Used in an ilList to notify the parent ilList that changes were made.
  • ilMinLength: The minimum length that the list must have. If the list length is less than ilMinLength when the directive is linked, new items are pushed to the list (using ilNewItem). When decreasing the list, it will stop at this value. Default: 1.
  • ilMaxLength: The maximum length that the list can have. If the list length is greater than ilMaxLength when the directive is linked, the items after its value are removed. When increasing the list, it will stop at this value. Default: 9007199254740991 (Number.MAX_SAFE_INTEGER).
  • ilEnableHasFocus: Enables the $ilList.hasFocus function (see below). This will add a focus and blur listener to every input that has ilItemModel.
  • ilDecreaseMiddle: Allows items in the middle to be removed. It is recommended to use it with $ilList.hasFocus so that focus is not stolen.

The directives ilIncreaseOn, ilDecreaseOn and ilNewItem have a local scope with an $ilList object that has the following functions:

  • emptyModel: returns true if all input model values are empty
  • emptyView: returns true if all input view values are empty (default for ilDecreaseOn)
  • fullModel: returns true if all input model values are not empty
  • fullView: returns true if all input view values are not empty
  • modelExists: returns true if the model value of the modified input exists (default for ilIncreaseOn)
  • viewExists: returns true if the view value of the modified input exists
  • hasFocus: returns true if an input of the item has focus (enabled with ilEnableHasFocus)