Skip to content

Conversation

@christurnbull
Copy link

Added functionality:

DEMO: http://plnkr.co/edit/WRaLC2?p=preview

  • handle ngResource promise and null/empty promises
  • attribute to submit form - if a promise is supplied the button turns into type="submit"
  • attributes for button success/error class - defaults to btn-success/btn-danger
  • attribute to revert to original class after revert period
  • classes for span elements & use fa-spin class
  • added dependency injection annotations

 *  handle ngResource promise and null/empty promises
 *  attribute to submit form - if a promise is supplied the button turns into type="submit"
 *  attributes for button success/error class - defaults to btn-success/btn-danger
 *  attribute to revert to original class after revert period
 *  classes for span elements & use fa-spin class
 *  added dependency injection annotations
Added fix for bug in some browsers when submitting form
*/
angular.module('ngPromiseButton', [])
.directive('promiseButton', function ($compile, $timeout) {
.directive('promiseButton', ['$compile', '$timeout' , function ($compile, $timeout) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like messing the code with build related overhead like this. This can be done build-time using for example https://github.com/olov/ng-annotate

@DocX
Copy link
Owner

DocX commented Feb 14, 2016

Thanks christurnbull, I'm glad you found it useful.

Your changes looks great. Check the comments above and we can move it.

Also please remove the modification of README file from PR - I obviously cannot merge to upstream saying "This is a fork". I will add you to contributors section and update the demo link after pull.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants