az-promise-show
Version:
angular directives to show or hide an element based on the state of a promise
62 lines (43 loc) • 1.95 kB
Markdown
# az-promise-show
[](https://www.npmjs.org/package/az-promise-show)
[](http://npm-stat.com/charts.html?package=az-promise-show&from=2015-01-01)
[](https://codeship.com/projects/85923)
[](https://codecov.io/github/alianza-dev/az-promise-show)
[](https://gitter.im/alianza-dev/az-promise-show?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Directives to show or hide an element based on the resolved state of an angular promise.
See [the example](http://az-promise-show.surge.sh/) and
[the example code](https://github.com/alianza-dev/az-promise-show/blob/master/demo/index.html)
## Docs
### Usage
#### Install the module
`$ npm install az-promise-show --save`
Or just download it from the dist directory.
#### Depend on the module
```javascript
angular.module('yourModule', ['azPromiseShow']);
```
#### az-promise-show
```html
<div az-promise-show="aPromise">
I'm only shown when the promise is in flight
</div>
```
#### az-promise-hide
```html
<div az-promise-hide="anotherPromise">
I'm only show when the promise is not in flight
</div>
```
#### az-promise-show-hide-class
```html
<div az-promise-show="aPromise" az-promise-show-hide-class="display-none">
By default, azPromiseShow uses 'ng-hide', but you can specify your own if you want.
Or, you can use the azPromiseShowOptions service.
</div>
```
#### azPromiseShowOptions
```javascript
angular.module('yourModule').run(function(azPromiseShowOptions) {
azPromiseShowOptions.className = 'display-none';
});
```