Skip to content

Commit

Permalink
modify readme examples
Browse files Browse the repository at this point in the history
  • Loading branch information
lordfriend committed Nov 9, 2014
1 parent a1e5fa8 commit ce7dc3a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ before_script:
# whitelist
branches:
only:
- master
- master

18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# nya-bootstrap-select #
# nya-bootstrap-select

**nya-bootstrap-select 2** is an AngularJS directive set inspired by @silviomoreto 's [bootstrap-select](https://github.com/silviomoreto/bootstrap-select) . With this directive you can built an **bootstrap-select** with data-binding feature of angularjs.
The 2.x version is totally written. while keep the most feature of **bootstrap-select** but no longer depends jquery and bootstrap-select plugin.

Require: angular 1.2+

##Usage##
##Usage

1. Install

Expand All @@ -32,9 +32,9 @@ Require: angular 1.2+

**Migrate from 1.x** If you have used the previous version of this directive. you need to replace the old code in the template. See the examples below

##Examples##
##Examples

###Static Options###
###Static Options

You can use static options which means you can't change the option when the HTML code is ready. Under this usage, you don't use the `nya-bs-option` directive, but you should add `nya-bs-option` class to all the `<li>` element and `value` attribute to let the directive know you option's value.

Expand All @@ -60,10 +60,10 @@ You can use static options which means you can't change the option when the HTML

If you decide to use static option, you shouldn't change the option any more, otherwise you may need the `nya-bs-option` directive to generate options dynamically.

###Dynamic Options###
###Dynamic Options
In this section you'll see several usage of the `nya-bs-option` directive.

####Basic usage####
####Basic usage
This is the very basic usage, we have an array of object used to generate options. the `myModel` will be one of the objects in the `options` array. if you add an `mulitple` attribute to the `nya-bs-select` element. `myModel` will be array of objects.

```html
Expand All @@ -74,21 +74,21 @@ This is the very basic usage, we have an array of object used to generate option
</ol>
```

####Group By Object Property####
####Group By Object Property
Like vanilla `<select>` we can also generate option group with any property in an object. if you `options` is an array of object. like [{name: "alpha", group: "Group 1"}, {name: "beta", group: "Group 2}, {name: "charlie", group: "Group 2"}]. then we can use group by in `nya-bs-option` expression to generate group.

```html
<ol class="nya-bs-select" ng-model="myModel">
<li nya-bs-option="option in options group by option.group">
<span class="group-header">$group</span>
<span class="dropdown-header">{{$group}}</span>
<a>
{{option.name}}
</a>
</li>
</ol>
```

##TODO##
##TODO

- data-header support
- data-container support
Expand Down

0 comments on commit ce7dc3a

Please sign in to comment.