All Projects → leocaseiro → Angular Chosen

leocaseiro / Angular Chosen

Licence: mit
AngularJS Chosen directive is an AngularJS Directive that brings the Chosen jQuery in a AngularJS way

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Angular Chosen

tagselector
Dependency-free JS library that turns select fields in customizable tag clouds
Stars: ✭ 19 (-97.27%)
Mutual labels:  select, dropdown, multiple
React Native Dropdown Picker
A single / multiple, categorizable & searchable item picker (dropdown) component for react native which supports both Android & iOS.
Stars: ✭ 230 (-66.91%)
Mutual labels:  select, dropdown, multiple
react-functional-select
Micro-sized & micro-optimized select component for React.js
Stars: ✭ 165 (-76.26%)
Mutual labels:  select, dropdown
frontal
An Angular select/dropdown component
Stars: ✭ 20 (-97.12%)
Mutual labels:  select, dropdown
mithril-select
Custom Select Component for Mithril.js
Stars: ✭ 14 (-97.99%)
Mutual labels:  select, dropdown
react-multi-select-component
Lightweight (~5KB gzipped) multiple selection dropdown component
Stars: ✭ 279 (-59.86%)
Mutual labels:  select, dropdown
react-native-select-dropdown
react-native-select-dropdown is a highly customized dropdown | select | picker | menu for react native that works for andriod and iOS platforms.
Stars: ✭ 156 (-77.55%)
Mutual labels:  select, dropdown
vue-single-select
single select dropdown with autocomplete
Stars: ✭ 43 (-93.81%)
Mutual labels:  select, dropdown
Easydropdown
A lightweight library for building beautiful styleable <select> elements
Stars: ✭ 337 (-51.51%)
Mutual labels:  select, dropdown
React Dropdown Tree Select
Lightweight, accessible, customizable and fast Dropdown Tree Select component for React
Stars: ✭ 345 (-50.36%)
Mutual labels:  select, dropdown
Single Spa Portal Example
Example project on how to combine multiple SPA's on a single Website
Stars: ✭ 376 (-45.9%)
Mutual labels:  multiple, angularjs
insect
🛠 Highly customisable, minimalistic input x select field for React.
Stars: ✭ 33 (-95.25%)
Mutual labels:  select, dropdown
choc-autocomplete
🏇 Autocomplete Component Package for Chakra UI
Stars: ✭ 286 (-58.85%)
Mutual labels:  select, dropdown
react-native-select-pro
React Native dropdown (select) component developed by Mobile Reality
Stars: ✭ 79 (-88.63%)
Mutual labels:  select, dropdown
react-native-autocomplete-dropdown
Dropdown Item picker with search and autocomplete (typeahead) functionality for react native
Stars: ✭ 87 (-87.48%)
Mutual labels:  select, dropdown
hierarchy-select
Hierarchy Select jQuery Plugin for Twitter Bootstrap
Stars: ✭ 40 (-94.24%)
Mutual labels:  select, dropdown
Slim Select
Slim advanced select dropdown
Stars: ✭ 517 (-25.61%)
Mutual labels:  select, dropdown
Ng Select
⭐ Native angular select component
Stars: ✭ 2,781 (+300.14%)
Mutual labels:  select, dropdown
vue-tags-component
Vue.js 2+ tags component
Stars: ✭ 27 (-96.12%)
Mutual labels:  select, dropdown
Material Ui Superselectfield
multiselection autocomplete dropdown component for Material-UI
Stars: ✭ 260 (-62.59%)
Mutual labels:  select, dropdown

Angular Chosen Localytics Bower npm

AngularJS Chosen directive

This directive brings the Chosen jQuery plugin into AngularJS with ngModel and ngOptions integration.

To use, include localytics.directives as a dependency in your Angular module. You can now use the chosen directive as an attribute on any select element. Angular version 1.3+ is required, but recommended 1.4.9+.

Full Documentation with Examples

Installation (npm or bower)

Via bower

$ bower install angular-chosen-localytics --save

Via npm

$ npm install angular-chosen-localytics --save

Via cdn

<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-chosen-localytics/1.9.2/angular-chosen.min.js"></script>

Or download zip file

Download v1.9.2

Yeoman or Bower install

If you use Yeoman or Bower install, you need to rename the chosen.jquery.js or the chosen.proto.js to chosen.js. Otherwise Chosen won't be included in your index.html.

Features

  • Works with ngModel and ngOptions
  • Supports usage of promises in ngOptions
  • Provides a 'loading' animation when 'ngOptions' collection is a promise backed by a remote source
  • Pass options to Chosen via attributes or by passing an object to the Chosen directive
  • Provider with default values with chosenProvider (read: Added config-provider) [since 1.6.0]

Usage

Simple example

Similar to $("#states").chosen()

<select chosen multiple id="states">
  <option value="AK">Alaska</option>
  <option value="AZ">Arizona</option>
  <option value="AR">Arkansas</option>
  <option value="CA">California</option>
</select>

Pass any chosen options as attributes

<select chosen
        data-placeholder-text-single="'Pick one of these'"
        disable-search="true"
        allow-single-deselect="true">
  <option value=""></option>
  <option>This is fun</option>
  <option>I like Chosen so much</option>
  <option>I also like bunny rabbits</option>
</select>

Note: the empty option element is mandatory when using allow-single-deselect

Integration with ngModel and ngOptions

<select multiple
        chosen
        ng-model="state"
        ng-options="s for s in states">
</select>

Note: don't try to use ngModel with ngRepeat. It won't work. Use ngOptions. It's better that way.

Also important: if your ngModel is null or undefined, you must manually include an empty option inside your <select>, otherwise you'll encounter strange off-by-one errors:

<select multiple
        chosen
        ng-model="state"
        ng-options="s for s in states">
  <option value=""></option>
</select>

This annoying behavior is alluded to in the examples in the documentation for ngOptions.

Works well with other AngularJS directives

<select chosen
        ng-model="state"
        ng-options="s for s in states"
        ng-disabled="editable">
  <option value=""></option>
</select>

Loading from a remote data source

Include chosen-spinner.css and spinner.gif to show an Ajax spinner icon while your data is loading. If the collection comes back empty, the directive will disable the element and show a default "No values available" message. You can customize this message by passing in noResultsText in your options.

app.js
angular.module('App', ['ngResource', 'localytics.directives'])
    .controller('BeerCtrl', function($scope, $resource) {
      $scope.beers = $resource('api/beers').query()
    });
index.html
<div ng-controller="BeerCtrl">
  <select chosen
          data-placeholder-text-single="'Choose a beer'"
          no-results-text="'Could not find any beers :('"
          ng-model="beer"
          ng-options="b for b in beers">
      <option value=""></option>
  </select>
</div>

Image of select defined above in loading state: <img src="https://raw.github.com/localytics/angular-chosen/master/example/choose-a-beer.png">

Note: Assigning promises directly to scope is now deprecated in Angular 1.2+. Assign the results of the promise to scope once the promise returns. The loader animation will still work as long as the collection expression evaluates to undefined while your data is loading!

Default values with chosenProvider (thanks @zlodes) [since 1.6.0]

angular.module('chosenExampleApp', ['localytics.directives'])
    .config(['chosenProvider', function (chosenProvider) {
        chosenProvider.setOption({
            no_results_text: 'There is no results!',
            placeholder_text_multiple: 'Choose one or more!'
        });
    }]);
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].