jeremypeters / ng-bs-animated-button

Angular/Bootstrap animated submit button directive
MIT License
145 stars 25 forks source link

Moved text labels config to attributes and switched $watch to $on #7

Closed syabro closed 2 years ago

syabro commented 10 years ago
  1. All view stuff should be inside html. So I moved text to be configured as attributes in html, and not in controller. Also classes other config stuff should be refactored too

Now button looks like

<jp-ng-bs-animated-button
    button-default-text="Login"
    button-submitting-text="Loading..."
    button-success-text="Access granted"
    button-error-text="Access denied"></jp-ng-bs-animated-button>
  1. Replaced $watch variables with more obvious events.

To control behavior we need to emit signal from scope:

$scope.$broadcast('submit-button-event', {
    submitting: true
});

First argument is object and could have 3 attributes to control status: submitting, success, error

syabro commented 10 years ago
  1. Moved buttonDefaultText to element's innerHTML Now it should be used
<jp-ng-bs-animated-button
    button-submitting-text="Loading..."
    button-success-text="Access granted"
    button-error-text="Access denied">LOGIN</jp-ng-bs-animated-button>
syabro commented 10 years ago

If you ok with these big changes and remove js prefix I'll refactor all other stuff and update documents. If not I'll continue work on my fork ;)

jeremypeters commented 10 years ago

Great stuff, thanks syabro. Yep, if you could refactor the other stuff (inc. the prefix) and docs as well, that'd be awesome.

EdgarOrtegaRamirez commented 8 years ago

This is great, +1 to get this merged. I love the way to set texts using directive attributes rather than a js object.