Giter Club home page Giter Club logo

angular-autodisable's People

Contributors

aswin-s avatar dflourusso avatar floftar avatar kirstein avatar loicmahieu avatar stnor avatar

Stargazers

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

angular-autodisable's Issues

does not work within a transclude directive.

a tranclude directive will clone its children element, that would make the elementToDisalbe in handlerInstance different from real element. so the disable won't work.

I think you should do the handlerInstance within linkFn instead of compile,

autodisable form submit button

I'm trying to use this directive on a form with a button[type="submit"]. The problem is...

The child button is generated in a directive itself. (<md-button type="submit">Submit</md-button).

This is likely an issue where the child button is processed after the parent ng-autodisable linking function has run. Any suggestions?

Click event registered on forms

When using the directive with forms it looks like a click event is being registered. When I click into my form, the ng-submit handler is invoked.

My HTML:

      <form name="formMenuItem" ng-submit="vm.saveMenuItem()" ng-autodisable>
        <button class="btn btn-primary" type="submit" ng-disabled="formMenuItem.$invalid">
          <span ng-if="vm.menuItem.id">Add Menu Item</span>
          <i class="icon icon-tick"></i>
        </button>
      </form>

Controller:

    function saveMenuItem() {
      return vm.menuItem.id ? updateMenuItem() : addMenuItem();
    }

    function addMenuItem() {
      return menuService.addMenuItem(menu, vm.menuItem).then(function (mi) {
        menu.items.push(mi);
        notify.success('Menu Item added successfully.');
        resetMenuItemForm();
      });
    }

'disabled' attribute is ineffective on an 'a' element

Hello,
First, thank you very much for this great module. I use it in my new project and it is very useful and convenient.
I think the following pattern is commonly used :

<a href="" ng-click="myFunction()">Myfunction</a>

With angular-autodisable, it would be useful to write that:

<a href="" ng-click="myFunction()" ng-autodisable>Myfunction</a>

Unfortunately, it does not work, since the disabled attribute does not forbid the ng-click to occur.
I made a fix for my project: I get the element to disable as a parameter of triggerHandler and I immediatly return in triggerHandler if this element has the disabled attribute.

handling ng-disabled

One might want to disable / enable form inputs depending on some state. Currently, ng-autodisable and ng-disabled don't work well together, and we could have the situation where ng-autodisable has disabled an input, but a digest caused ng-disabled to reenable it while promise is not resolved yet.

Maybe there could be a simple / clever way to handle this.

Change ng-* prefix

The prefix ng-* in directive might conflict with future native directives.

Not working with ng-submit

Here is my jade template

form(name='signInForm' ng-submit="signIn()" ng-autodisable)
  input(type="email" ng-model="email" placeholder='Email' ng-required='true')
  input(type="password" ng-model="password" placeholder='Password' ng-required='true')
  button(type="submit" ng-disabled="signInForm.$invalid") Sign In

jqLite's find() is limited to lookups by tag name

therefore, this snippet never finds any buttons to disable

          handler = handlerInstance(element.find('button[type=submit]'),
              SUBMIT_EVENT,
              getLoadingClass(attrs),
              getCallbacks(attrs[SUBMIT_ATTR]));

maybe you could use something like element[0].querySelectorAll('button[type=submit]') instead?

need to config when to disable.

when I submit a form in $modal(with animation: true), if I click very fast, the form will submit twice.
Because when the promise is done, the disabled is set to false, but the animation is not completed, I can still submit the form if I click very fast.
so, I want to config when to set disable to false.
In this scenorio, I want just when the promise is success, I set the disable to fase.

not work with ngTouch module.

cause ngTouch module's ngClick directive using touch event to trigger click event. and disabled element can trigger touch event. so this won't work.

I can send a PR to fix this issue, does anyone maintain this project ?

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.