GithubHelp home page GithubHelp logo

pleerock / angular-disable-all Goto Github PK

View Code? Open in Web Editor NEW
21.0 3.0 13.0 19 KB

Angular directive that allows to disable any element (for example DIV) contents and disable clicks on the given element

License: Apache License 2.0

JavaScript 100.00%

angular-disable-all's Introduction

disable-all directive for AngularJS

This directive allows to disable a given element and all buttons, inputs and other form controls will be disabled.

Open samples/index.html to see the example how to use this directive.

Installation

  1. Run bower install angular-disable-all --save

    • (or add manually into your bower.json dependencies and run bower-install)
    • (or download ZIP from github and extract files in the case if you don't use bower)
  2. Include bower_components/angular-disable-all/dist/angular-disable-all.js in your index.html file

  3. Add a new dependency in your module

angular.module('yourApp', ['disableAll', ...])

How to use it

Lets say you have a div with a form and inputs and buttons inside:

<div disable-all="true">

    <form>
        <input name="name" type="text">
        <button>submit</button>
    </form>
    
    <!-- This will not be disabled -->
    <a href="http://google.com" skip-disable>google</a>

</div>

Note: The skip-disable directive allow you to exclude a DOM element of the disable-all directive.

You can also specify boolean variable to disable-all, directive will watch it and disable / enable div when variable changes.

<div disable-all="isDisabled">

    <form>
        <input name="name" type="text">
        <button>submit</button>
    </form>

</div>

TODO-s (for contributors):

  • refactor some parts of code and make it easier to understand and maintain
  • better documentation and more examples if possible
  • cover sources with unit-tests
  • research in performance optimizations
  • search for bugs and fix them
  • star this project and get people to know about this plugin in angular community

angular-disable-all's People

Contributors

evdoks avatar jjchiw avatar maximegris avatar

Stargazers

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

Watchers

 avatar  avatar  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.