Angular directive for buttons or links that trigger a deferred call and display status and outcome in the button itself.
Install it via bower:
$ bower install angular-promise-react --save
or download the minified source from github.
Include angular-promise-react0s script tag after angularjs's one:
<script type="text/javascript" src="angular-promise-react/angular-promise-react.js"></script>
Inject promise-react
directive into your angular module:
angular.module('myApp', ['promise-react'])
Full documentation and examples in here
<a promise-button="deferredAction()">
Current status: {{status}}
<span when-promise="idle"> Initial text </span>
<span when-promise="loading"> Loading... </span>
<span when-promise="intermediate"> Received notification containing {{state}} </span>
<span when-promise="done">Finished correctly with result: {{state}}</span>
<span when-promise="failed">Completed with error: {{state}}</span>
<span when-promise>I show whenever the button is not idle</span>
<br>
<span when-progress="50">Action is halfway</span>
<span when-progress>Action has started and has not finished (loading or intermediate)</span>
</a>
<a promise-button="deferredAction()" promise-trigger="dblclick">
<promise-default>
Default button label
</promise-default>
</a>
Licensed under the terms of the Apache license 2.0