GithubHelp home page GithubHelp logo

vikasg7 / checkbox-select Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 11 KB

Create checkbox lists with multiple or individual selections

Home Page: https://plnkr.co/edit/prrHUd7r93XxIpZKdSNU

JavaScript 69.06% HTML 30.20% CSS 0.73%
angular-plugin checkboxlist checkbox angular directive

checkbox-select's Introduction

checkbox-select angular plugin

Create checkbox lists with multiple or individual selections

Demo

Check out this plnkr:- https://embed.plnkr.co/prrHUd7r93XxIpZKdSNU/

How to use / install

- Download `checkbox-select.js` file in your project folder.
  • Add it to your index.html using script tags.

  • Add a reference to checkbox-select module while initiating the angular-app like below

    angular.module("APP", ["checkbox-select"])         
  • Now in the controller, define a list to iterate over using ng-repeat and a variable on scope to hold the selections, like below:-

    angular
       .module("APP", ["checkbox-select"])
       .controller("demoCtrl", ["$scope", function ($scope) {
          var dc = this
          // Defining list to iterate over
          dc.list = [
             "selection1",
             "selection2",
             "selection3"
          ]
          // Defining variable to hold the selections
          dc.multipleSelections = []
       }])
  • Now you can add the following attributes to the input element like below

    <label ng-repeat="thing in dc.list">
       <input type="checkbox" checkbox-model="dc.multipleSelections" checkbox-value="thing" multiple>
       {{thing}}
    </label>
  • Directive Attributes:-

    Attribute Value Optional/not
    checkbox-model An Array variable on the scope to hold the selections. for eg. dc.multipleSelections Mandatory
    checkbox-value Iterator variable in ng-repeat Mandatory
    multiple No value. Using it, will allow multiple selections. Remove it, if you want to select one checkbox at a time Optional

Donate

If this repository helps you anyhow, please don't mind coming back and Buy Me Coffee OR you can use Gratipay to show your appreciation and gratitude.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.