Git Product home page Git Product logo

isabella232 / nya-bootstrap-select Goto Github PK

View Code? Open in Web Editor NEW

This project forked from extensis/nya-bootstrap-select

0.0 0.0 0.0 182 KB

An AngularJS directive wrapper for silviomoreto's Bootstrap-select, which supports ngRepeat in option tag and ngOptions to dynamically build a Bootstrap-select

Home Page: http://nya.io/nya-bootstrap-select/

License: MIT License

JavaScript 95.12% CSS 4.88%

nya-bootstrap-select's Introduction

nya-bootstrap-select

Build Status

An AngularJS directive wrapper for silviomoreto's Bootstrap-select, which supports ngRepeat in options to dynamically build a Bootstrap-select.

Requirements: AngularJS 1.0+, jQuery 1.7+, Bootstrap-select 1.3+

Usage

  1. install via bower
$ bower install nya-bootstrap-select
  1. include the nyaBootstrapSelect module as a dependency for your app.
angular.module('myApp', ['nya.bootstrap.select'])
  1. include the bootstrap-select js and css file in your html.

  2. Create your <select> with the .nya-selectpicker class or 'nya-selectpicker' attribute. You can use ngRepeat or ngOptions directive to generate <option>. 'ngRepeat' directive is only preferred to use in simple situations. ngOptions is a good choice for generating both <option> and <optgroup>. if you use ng-repeat to generate your option tags. add an ng-model directive to bind a model to your <select>. In order to update the model according to your select, your should bind value with your models.

<select class="nya-selectpicker" ng-model="myModel">
  <option ng-repeat="option in options" value="{{option}}">{{option}}</option>
</select>

ngOptions example:

<select class="nya-selectpicker" ng-model="myModel" ng-options="c.name for c in options">
</select>

Note that you shouldn't use both two method at same time.

  1. init your options model. you can retrieve your model from server any time. when options model changes. ng-repeat will update the <option> s. nya-bootstrap-select directive will update your select as well.
$scope.options = ['alpha', 'bravo', 'charlie'];
  1. Fire up your angular app.

License

Licensed under the MIT license

nya-bootstrap-select's People

Contributors

lordfriend avatar kuhnza avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.