# ui-select2
**Repository Path**: BlueBell-Rain/ui-select2
## Basic Information
- **Project Name**: ui-select2
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2024-03-20
- **Last Updated**: 2024-03-20
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
ui-select2 (deprecated) [](https://travis-ci.org/angular-ui/ui-select2)
========================
# Annoucement
This **directive is now obsolete**. A new initiative, more active, and 100% angular is available at https://github.com/angular-ui/ui-select.
As development slowed down on ui-select2, it is getting unlikely that bugs will be fixed. So the new alternative should be used as soon as possible.
# Description
This directive allows you to enhance your select elements with behaviour from the [select2](http://ivaynberg.github.io/select2/) library.
# Requirements
- [AngularJS](http://angularjs.org/)
- [JQuery](http://jquery.com/)
- [Select2](http://ivaynberg.github.io/select2/)
## Setup
1. Install **Karma**, **Grunt** and **Bower**
`$ npm install -g karma grunt-cli bower`
2. Install development dependencies
`$ npm install`
3. Install components
`$ bower install`
4. ???
5. Profit!
## Testing
We use [Grunt](http://gruntjs.com/) to check for JavaScript syntax errors and execute all unit tests. To run Grunt, simply execute:
`$ grunt`
This will lint and test the code, then exit. To have Grunt stay open and automatically lint and test your files whenever you make a code change, use:
`$ grunt karma:server watch`
This will start a Karma server in the background and run unit tests in Firefox and PhantomJS whenever the source code or spec file is saved.
# Usage
We use [bower](https://github.com/bower/bower) for dependency management. Install AngularUI Select2 into your project by running the command
`$ bower install angular-ui-select2`
If you use a `bower.json` file in your project, you can have Bower save ui-select2 as a dependency by passing the `--save` or `--save-dev` flag with the above command.
This will copy the ui-select2 files into your `bower_components` folder, along with its dependencies. Load the script files in your application:
```html
```
(Note that `jquery` must be loaded before `angular` so that it doesn't use `jqLite` internally)
Add the select2 module as a dependency to your application module:
```javascript
var myAppModule = angular.module('MyApp', ['ui.select2']);
```
Apply the directive to your form elements:
```html
```
## Options
All the select2 options can be passed through the directive. You can read more about the supported list of options and what they do on the [Select2 Documentation Page](http://ivaynberg.github.com/select2/)
```javascript
myAppModule.controller('MyController', function($scope) {
$scope.select2Options = {
allowClear:true
};
});
```
```html
```
Some times it may make sense to specify the options in the template file.
```html
```
To define global defaults, you can configure the `uiSelect2Config` injectable:
```javascript
myAppModule.run(['uiSelect2Config', function(uiSelect2Config) {
uiSelect2Config.placeholder = "Placeholder text";
}]);
```
## Working with ng-model
The ui-select2 directive plays nicely with ng-model and validation directives such as ng-required.
If you add the ng-model directive to same the element as ui-select2 then the picked option is automatically synchronized with the model value.
## Working with dynamic options
`ui-select2` is incompatible with `