diff --git a/examples/app2.js b/examples/app2.js new file mode 100644 index 0000000..f54aae1 --- /dev/null +++ b/examples/app2.js @@ -0,0 +1,3 @@ +/** + * Created by bob on 12/8/14. + */ diff --git a/examples/index2.html b/examples/index2.html new file mode 100644 index 0000000..15fed97 --- /dev/null +++ b/examples/index2.html @@ -0,0 +1,518 @@ + + +
+ +An angular wrapper for Bootstrap-select with dynamic loading options support
+ View on Github +This is an angular directive wrapping for popular custom select Bootstrap-select.
+ Unlike other directives. This directive support ng-repeat
in option
.
+
All of the Bootstrap-select's + function is supported. + The select result is bound to a model, so you don't need to use + Bootstrap-select's api to get + value. + just write your select in the angular way +
+ +Track by is nothing different with ng-repeat
+ + + +If you want show grouped options. we assume you have an property which being used to group by. add group by property
after the
+ collection
in your nya-bs-option
statement
add <span class="dropdown-header">{{$group}}</span>
before the <a>
element
Like ng-repeat, object collection is also supported
+ + +Features borrowed from Bootstrap-select
+ +set btn-primary
, btn-success
, btn-info
, btn-warning
, btn-danger
to nya-bs-select
Add data-live-search="true"
in nya-bs-select
directive to add live search support
You can set title
attribute on each nya-bs-option
as an alternative to display when an option is selected.
+ To display an default information when nothing is selected. just set title
attribute in nya-bs-select
directive.
+ Note: This only works on multiple nya-bs-select
. For single nyab-bs-select
You should give your model an default value to avoid the default text to display
+
Using the data-selected-text-format
attribute on an multiple nya-bs-select
you can specify how the selection is displayed.
values
A comma delimited list of selected values.(default)
count
If one item is selected, then the value is shown, if more than one is selected then the number of selected items is displayed.
count > x
Where X is the number of items selected when the display format changes from values
to
+ count
This feature is implemented by yourself. You don't need add show-tick class to nya-bs-select
. you just need to add the tick to each nya-bs-option
For example, if you want use Bootstrap Glyph. You need to add <span class="glyphicon glyphicon-ok check-mark"></span>
following the text content of a
+ nya-bs-option
as a child of <a></a>
If you want to use glyph in font-awesome, you can replace the glyphicon
with font-awesome class, but keep the check-mark
.
+ <ol class="nya-bs-select" ng-model="model2">
+ <li nya-bs-option="option in option1">
+ <a>
+ {{option}}
+ <span class="glyphicon glyphicon-ok check-mark"></span>
+ </a>
+ </li>
+ </ol>
+
+
+ Just add show-menu-arrow
class to nya-bs-select
Thanks to the structure of nya-bs-select. you can easy control the look of an option or the width of the directive
+ +Change any option styles as you like
+ + +Add col-lg-*
, col-md-*
or other grid column class to control the width of the directive
set size
to an number, which will limit the dropdown menu size to limit number of element. the default value is 'auto'
Add disabled
class to any nya-bs-option
you want disabled
Addition Note: Unlike Bootstrap-select, setting disabled
attribute on optgroup
to disable entire group options is not supported because we don't have
+ optgroup
Add an <li>
element without nya-bs-option
attribute and class but with divider
class in your option list
Add a subtext on an nya-bs-option
is very straightforward because you have full control what you want to display
+ + <!-- You can put your subtext with any style inside the first child element of <a> --> + + <ol class="nya-bs-select" ng-model="model2"> + <li nya-bs-option="option in option1"> + <a> ++ ++ <span> + {{option}} + <small>option {{$index}}</small> + </span> +
+ <span class="glyphicon glyphicon-ok check-mark"></span> + </a> + </li> + </ol> + + + <!-- You can also put your subtext with any style aside the first child element of <a>. This format will + lead the subtext not shown in button. Note: you still need to wrap your option text with <span> or other inline tag + --> + + <ol class="nya-bs-select" ng-model="model2"> + <li nya-bs-option="option in option1"> + <a> ++ <span> + {{option}} + </span> + <small>option {{$index}}</small> +
+ <span class="glyphicon glyphicon-ok check-mark"></span> + </a> + </li> + </ol> +
Custom option content is nothing different with subtext.
+ + +set size
to an number, which will limit the dropdown menu size to limit number of element. the default value is 'auto'
for test
+ + +