Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit 4f46254

Browse files
committed
Cloned the wiki page
1 parent d8fed30 commit 4f46254

12 files changed

+809
-0
lines changed

ui-select.wiki/Accessing-$select.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Many requests for custom features can be satisfied by accessing the `uiSelectController` in your own custom directive.
2+
3+
To do this, create a directive of your own which `require`s the `uiSelect` directive, as shown below:
4+
5+
```js
6+
myModule.directive('myUiSelect', function() {
7+
return {
8+
require: 'uiSelect',
9+
link: function(scope, element, attrs, $select) {
10+
11+
}
12+
};
13+
});
14+
```
15+
16+
Using it as illustrated below:
17+
```
18+
<ui-select my-ui-select ng-model="person.selected">
19+
<ui-select-match> ... </ui-select-match>
20+
<ui-select-choices> ... </ui-select-choices>
21+
</ui-select>
22+
```
23+
24+
Refer to the source code of [`uiSelectController`](https://github.com/angular-ui/ui-select/blob/master/src/uiSelectController.js) to see what is functionality is available through this API.
25+
26+
If you feel your directive may be useful to others, feel free to submit it is as a Pull Request for consideration for inclusion in the library.
27+
28+
### Examples
29+
1. [Select active item on Blur](https://github.com/angular-ui/ui-select/issues/1544#issuecomment-204028310)
30+
2. [Placeholder Always Visible](https://github.com/angular-ui/ui-select/pull/1433#issuecomment-225011882)

ui-select.wiki/FAQs.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
## Common Issues
2+
3+
### ng-model not working with a simple variable on $scope
4+
5+
You cannot write:
6+
```HTML
7+
<ui-select ng-model="item"> <!-- Wrong -->
8+
[...]
9+
</ui-select>
10+
```
11+
12+
You need to write:
13+
```HTML
14+
<ui-select ng-model="item.selected"> <!-- Correct -->
15+
[...]
16+
</ui-select>
17+
```
18+
19+
Or:
20+
```HTML
21+
<ui-select ng-model="$parent.item"> <!-- Hack -->
22+
[...]
23+
</ui-select>
24+
```
25+
26+
For more explanations, check [ui-select #18](https://github.com/angular-ui/ui-select/issues/18) and [angular.js #6199](https://github.com/angular/angular.js/issues/6199).
27+
28+
### ng-bind-html gives me "Error: [$sce:unsafe] Attempting to use an unsafe value in a safe context"
29+
30+
You need to use module [ngSanitize](http://docs.angularjs.org/api/ngSanitize) (recommended) or [$sce](http://docs.angularjs.org/api/ng/service/$sce):
31+
32+
```JavaScript
33+
$scope.trustAsHtml = function(value) {
34+
return $sce.trustAsHtml(value);
35+
};
36+
```
37+
38+
```HTML
39+
<div ng-bind-html="trustAsHtml((item | highlight: $select.search))"></div>
40+
```
41+
42+
### I get "TypeError: Object [...] has no method 'indexOf' at htmlParser"
43+
44+
You are using ng-bind-html with a number:
45+
```HTML
46+
<div ng-bind-html="person.age | highlight: $select.search"></div>
47+
```
48+
49+
You should write instead:
50+
```HTML
51+
<div ng-bind-html="''+person.age | highlight: $select.search"></div>
52+
```
53+
54+
Or:
55+
```HTML
56+
<div ng-bind-html="person.age.toString() | highlight: $select.search"></div>
57+
```
58+
59+
Or:
60+
```HTML
61+
<div ng-bind-html="String(person.age) | highlight: $select.search"></div>
62+
```
63+
64+
### How do I stop the drop-down from getting cut off by the bottom of my Bootstrap modal / container with `overflow: hidden`?
65+
66+
Add `append-to-body="true"` to the `ui-select` tag. See the [`ui-select` directive wiki page](https://github.com/angular-ui/ui-select/wiki/ui-select).
67+
68+
### Filter highlighter ruin words in some languages such as Persian and arabic
69+
70+
You can use zwjHighlighter from following url: https://github.com/deadmann/AngularJSComponent
71+
It provided for persian language, and you may need to add your own language letters (only those who should stick to next letter) to the list of regex.
72+
```JavaScript
73+
function isZeroWidthJoiner(first, second){
74+
//Get First Character and match Whitespaces
75+
if(second.substr(0,1).match(/\s+/))
76+
return false;
77+
78+
//TODO: MODIFY HERE
79+
return !!first.substr(first.length>0?first.length-1:0).match(/[يئبپتجچحخسشصضطظعغفقکگلمنهی]/);
80+
}
81+
```
82+
83+
### Highlight filter doesn't support special characters (like accents)
84+
85+
Here is a gist with a highlight filter with accent support: https://gist.github.com/juannorris/fa32fb015acd1496c6dfd55b5359a1f9
86+
87+
Which you can then use as:
88+
89+
```HTML
90+
<div ng-bind-html="(name | customHighlight: $select.search) | trustAsHTML"></div>
91+
```
92+
93+
The filter should be able to support any special characters you need, by updating the `normalize` function accordingly.

ui-select.wiki/Getting-Started.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
### Requirements
2+
3+
- Angular >=1.2.18
4+
- ngSanitize module
5+
- jQuery ( optional for older browser support )
6+
- Bootstrap (v3)/Select2/Selectize CSS as appropriate
7+
8+
Browser compatibility starting at Internet Explorer 8 and Firefox 3.6.
9+
10+
11+
### Installing
12+
13+
There are multiple ways of adding the required files:
14+
15+
1) Clone, build the repository, and include the files
16+
17+
2) Link to a [CDN](https://cdnjs.com/libraries/angular-ui-select)
18+
19+
3) Install via Bower and include files
20+
21+
bower install angular-ui-select
22+
23+
reference the scripts
24+
25+
- `bower_components/angular-ui-select/dist/select.js`
26+
- `bower_components/angular-ui-select/dist/select.css`
27+
28+
---
29+
30+
For IE8 / FF3.6 support you must include:
31+
32+
<!--
33+
IE8 support, see AngularJS Internet Explorer Compatibility http://docs.angularjs.org/guide/ie
34+
For Firefox 3.6, you will also need to include jQuery and ECMAScript 5 shim
35+
-->
36+
<!--[if lt IE 9]>
37+
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.js"></script>
38+
<script src="http://cdnjs.cloudflare.com/ajax/libs/es5-shim/2.2.0/es5-shim.js"></script>
39+
<script>
40+
document.createElement('ui-select');
41+
document.createElement('ui-select-match');
42+
document.createElement('ui-select-choices');
43+
</script>
44+
<![endif]-->
45+
46+
For RequireJS, your setup might look like:
47+
48+
require.config({
49+
paths: {
50+
'angular': 'bower_components/angular/angular',
51+
'angular-ui-select': 'bower_components/angular-ui-select/dist/select'
52+
},
53+
shim: {
54+
'angular-ui-select': ['angular']
55+
}
56+
});
57+
58+
59+
Include the ui.select and ngSanitize modules in your application
60+
61+
var module = angular.module('myapp', ['ui.select', 'ngSanitize']);
62+
63+
### Basic example
64+
The most basic use of the directive in html ([plunker](http://plnkr.co/edit/K9alAMAzvUqCY7Or8RwY?p=preview))
65+
```html
66+
<ui-select ng-model="selected.value">
67+
<ui-select-match>
68+
<span ng-bind="$select.selected.name"></span>
69+
</ui-select-match>
70+
<ui-select-choices repeat="item in (itemArray | filter: $select.search) track by item.id">
71+
<span ng-bind="item.name"></span>
72+
</ui-select-choices>
73+
</ui-select>
74+
```
75+
With a related angular controller:
76+
```javascript
77+
angular.module('app')
78+
.controller('ctrl', ['$scope', function ($scope){
79+
$scope.itemArray = [
80+
{id: 1, name: 'first'},
81+
{id: 2, name: 'second'},
82+
{id: 3, name: 'third'},
83+
{id: 4, name: 'fourth'},
84+
{id: 5, name: 'fifth'},
85+
];
86+
87+
$scope.selected = { value: $scope.itemArray[0] };
88+
}]);
89+
```
90+
91+
_Note: Including additional stylesheets is required, depending on which theme is used, in order to have ui-select render as a dropdown box. The examples show which resources to use._

ui-select.wiki/Home.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#### [1. Getting Started](https://github.com/angular-ui/ui-select/wiki/Getting-Started)
2+
#### [2. ui-select Directive](https://github.com/angular-ui/ui-select/wiki/ui-select)
3+
#### [3. ui-select-match Directive](https://github.com/angular-ui/ui-select/wiki/ui-select-match)
4+
#### [4. ui-select-choices Directive](https://github.com/angular-ui/ui-select/wiki/ui-select-choices)
5+
#### [5. ui-select-no-choice Directive](https://github.com/angular-ui/ui-select/wiki/ui-select-no-choice)
6+
#### [6. uis-open-close Directive](https://github.com/angular-ui/ui-select/wiki/uis-open-close)
7+
#### [7. FAQs](https://github.com/angular-ui/ui-select/wiki/FAQs)
8+
#### [8. Accessing `$select`](https://github.com/angular-ui/ui-select/wiki/Accessing-$select)

ui-select.wiki/Roadmap.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Just to throw it all somewhere
2+
3+
* [x] Customizeable selected template
4+
* [x] Customizeable list item template
5+
* [x] Keyboard selection (up/down/enter)
6+
* [ ] Use left/right arrow keys to move the caret (ibeam) between items (multi-select)
7+
* [x] Filtering list by typing
8+
* [x] Capable of handling rich objects array
9+
* [x] Async data (handled by AngularJS and `ng-repeat`)
10+
* [ ] Pagination (far-future) [#316](https://github.com/angular-ui/ui-select/issues/316)
11+
* [ ] Scroll-based pagination (far-far-future)
12+
* [x] List Groups (future)
13+
* [ ] Validation (max/min/etc)
14+
* [ ] Tokenization using commas or string-separator (far-far-future)
15+
* [x] Keyboard shortcuts
16+
* [x] tabable
17+
* [x] backspace/del to clear the value while closed
18+
* [x] Key Down to open
19+
* [ ] Position
20+
* [ ] Append list to body or any other element [#41](https://github.com/angular-ui/ui-select/issues/41)
21+
* [ ] [Collision flip](http://api.jqueryui.com/position/) - Show the list above the target (if it dosen't fit) [#234](https://github.com/angular-ui/ui-select/issues/234)
22+
23+
Options(?):
24+
* [x] Close on selection
25+
* [x] Multi-select (tagging) & single-select
26+
* [ ] Custom sorting / matching / filtering
27+
* [ ] opt-out on Android/iOS devices
28+
29+
This covers almost everything select2 is capable of doing, which is by far the most comprehensive solution currently available.

ui-select.wiki/_Sidebar.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
###

0 commit comments

Comments
 (0)