uz-dropdown

simple dropdown menu as a angularjs directive.


Keywords
dropdown, autocomplete, angularjs, directive
License
MIT
Install
bower install uz-dropdown

Documentation

uzDropdown

Simple dropdown menu as a AngularJs directive.

install

Install this component using Bower:

$ bower instal uz-dropdown --save

Or download as Zip.

Usage

  1. In html, load script and css files with AngularJs.
<script src="../angular/angular.min.js"></script>

<link rel="stylesheet" href="./dist/css/uz-dropdown.css">
<script src="./dist/scripts/uz-dropdown.js"></script>
  1. In javascript, inject module named uz, and make list data.
<script>
  angular.module('myApp', ['uz'])
    .controller("MainCtrl", function($scope) {
      $scope.items = ["one", "two", "three", "four"];
      $scope.selected = [];
      $scope.keyword  = "";
  });
</script>
  1. Use uz-dropdown with list data.
  <uz-dropdown
    items='items'
    selected='selected'
    format='item'
    keyword='keyword'
    placeholder='input keyword ...'>
  </uz-dropdown>

Options

Attribute Options Default Description
items Array of Object - dropdown's list data.
selected Array of Object - selected object on dropdown.
format string {0} In dropdown, objects will be shown using this value. (*1)
keyword string `` Search keyword.
orderBy string `` Order key which is used in item's property name.
placeholder string - placeholder on input area.

*1 format

Type of Item Format Example
Array {0}, {1}, ... {n} "No.{0} {1}", "No.{0} {1} ${2}"
Object {key_1}, ... {key_n} "No.{id} {name} ${price}"
Object in Object {key_1.key_2}, ... "No.{id} {param.name} ${param.price}"

Development

In order to run it locally you'll need to fetch some dependencies and a basic server setup.

  • Install Bower & Grunt:

    $ [sudo] npm install -g bower grunt-cli
  • Install local dependencies:

    $ bower install && npm install
  • Build source files automatically, and also starts liveReload server:

    $ grunt watch

License

MIT License © ujiro99