/ng-response-button

Use a button to call a promise and show a repsonse in the button once resolved

Primary LanguageJavaScriptMIT LicenseMIT

ng-response-button

Use a button to call a promise and show a repsonse in the button once resolved

Works with or without ngAnimate, Bootstrap, Ionic, Font Awesome. Supports ngResource and handles form submit

DEMO: http://embed.plnkr.co/tkIaMwnhYmINgzoHz9D8/

Installation

Install via bower:

bower install ng-response-button

Add script to your index.html (if not using Grunt/wiredep/etc)

<script src='bower_components/ng-response-buttons/ngResponseButton.js'></script>

Add module to your application module dependencies

angular.module('ngApp', ['ngResponseButton'])...

Usage

Simple

<button class="btn ng-response-button" ng-response-button="doPromise()">Press me</button>

All options

<button class="button button-dark ng-response-button" ng-response-button="doPromise()"
  revert=3000
  success-class="btn-info"
  fail-class="btn-warning"
  success-icon="glyphicon glyphicon-thumbs-up"
  fail-icon="fa fa-frown-o"
  spinner-class="glyphicon glyphicon-minus"
  type="button"
  submit="form"
  ion-spinner="dots" 
  spinner-class="spinner-energized"
  >
  Submit Ionic Form
</button>

Dependencies

Support

Please open an issue for support.

Contributing

Please contribute using Github Flow. Create a branch, add commits, and open a pull request.

License

The code is available under the MIT license.