Git Product home page Git Product logo

ng-dropdown's Introduction

ng-dropdown

A simple AngularJS directive to provide dropdown menu functionality!

Supports tabIndex, keyboard navigation, and selection of options.

Code Climate

This project was built using ng-boilerplate!

Step 1: Install ng-dropdown

Install using Bower:

bower install ng-dropdown --save

Include js/ng-dropdown.min.js in your app. You may also want to include css/ng-dropdown.min.css. It's not necessary since you can specify the class that will show your dropdown menu (defaults to 'open'), but it's recommended.

Step 2: Load the ng-dropdown module

var app = angular.module('dropdown-demo', ['ngRoute', 'ng-dropdown'])

Step 3: Add the dropdown menu markup

<div dropdown="myFirstDropdown"
     dropdown-open-class="open"
     dropdown-active-class="active"
     dropdown-option-class="option"
     class="ng-dropdown">
  <div dropdown-field class="ng-dropdown-field">
    <div class="ng-dropdown-value" ng-bind="selected.one"></div>
  </div>
  <div dropdown-menu id="dropdown-demo-menu" class="ng-dropdown-menu">
    <div ng-repeat="option in options"
         ng-bind="option"
         ng-click="selected.one = option"
         class="option"></div>
  </div>
</div>

dropdown (value optional) The name of the directive. The value is a variable you can use to bind the dropdown instance. Look at the source to get a better idea of what's stored in this object.

dropdown-open-class (optional) The class that "shows" the dropdown menu which is initially hidden (defaults to "open").

dropdown-active-class (optional) The class that marks the dropdown as active so you can style it differently if necessary (defaults to "active").

dropdown-option-class (optional) A class added to each option in the dropdown so that the directive can eventually keep of which option is highlighted when using keyboard shortcuts like up arrow and down arrow (defaults to "option").

Disabling the dropdown

If you need to disable the dropdown menu in certain circumstances, you can add an expression to the dropdown-disabled attribute. If the expression evaluates to true, the dropdown will be disabled, for example, dropdown-disabled="1 === 1"

That's it, I hope you find this useful!

«–– Ian

ng-dropdown's People

Contributors

busterbeans avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ng-dropdown's Issues

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.