Giter Site home page Giter Site logo

namoscato / angular-multiselect Goto Github PK

View Code? Open in Web Editor NEW
12.0 4.0 7.0 1.88 MB

AngularJS multiselect component based off ngOptions

Home Page: https://namoscato.github.io/angular-multiselect/

License: MIT License

JavaScript 87.98% HTML 9.39% SCSS 2.63%
angularjs multiselect angularjs-multiselect ngoptions dropdown

angular-multiselect's Introduction

js npm version

AngularJS Multiselect

AngularJS multiselect component based off ngOptions.

Dependencies

Installation

npm

npm i amo-angular-multiselect

Bower

bower install amo-angular-multiselect

Usage

Declare a dependency on the amo.multiselect module:

angular.module('myModule', ['amo.multiselect']);

and add the amoMultiselect directive to your template:

<amo-multiselect
    ng-model="app.model"
    options="option.id as option.label for option in app.options">
</amo-multiselect>

where the value of options is of the following form:

[select as] label [group by group] for value in array

Keyword Description
select The result of this expression will be bound to the model of the parent <amo-multiselect> element. If not specified, select expression will default to value.
label The result of this expression will be the label for each option.
group The result of this expression will be used to group options.
value Local variable which will refer to each item in the array during iteration.
array An expression which evaluates to an array.

Settings

The following settings can be set on a per-instance basis via dasherized <amo-multiselect> attributes. Some settings can be set globally via camel cased amoMultiselectConfig constant properties.

Name Type Global Default Description
conjunctionText @string Yes and Coordinating conjunction text used to join option labels
deselectAllText @string Yes Deselect All Deselect all option label text
filterText @string Yes Search... Search filter input placeholder text
isDeselectAllEnabled <boolean Yes true State of deselect all functionality
isDisabled <boolean No false State of dropdown toggle functionality
isFilterEnabled <boolean Yes true State of search filter input visibility
isSelectAllEnabled <boolean Yes true State of select all functionality
label &string No Expression bound to the current button label text
limitTo <number Yes 500 Upper bound limit of options to show per group so that browser performance will not suffer with large data sets. Specify 0 or false to disable limiting.
name @string No Unique instance name used as the value of the button's id attribute
onChange &function(label) No Expression called with label string when model changes
onToggleDropdown &function(isOpen) No Expression called with isOpen boolean when dropdown opens or closes
selectAllText @string Yes Select All Select all option label text
selectedSuffixSingularText @string Yes item Singular suffix appended to button label text when option label properties are undefined
selectedSuffixText @string Yes items Suffix appended to button label text when option label properties are undefined
selectText @string Yes Select... Default button label text when no options are selected

Development

npm i
npm start

Running Tests

npm test

angular-multiselect's People

Contributors

blacksmoke16 avatar dependabot-preview[bot] avatar dependabot[bot] avatar namoscato avatar nrutman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

angular-multiselect's Issues

you're slacking

you haven't updated this repository in two months. back to work.

Label functionality isn't working as expected

If you use a <label> with a for attribute referencing this component's id nothing happens when the user presses the label. Ideally you should be able to press the label and trigger the open event.

In the image below I've underlined the current linkage of for to id. If you put the id on the <button> instead of on the component then the browser will make clicking the label also click the button. Tested only in Chrome so far.

Current markup is a quick look at the markup.

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.