# unicorn-ng-reflex

> Easy working with async forms, buttons, etc

Latest version **0.1.1** (published 2015-11-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install unicorn-ng-reflex
pnpm add unicorn-ng-reflex
yarn add unicorn-ng-reflex
bun add unicorn-ng-reflex
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2015-11-12 |
| First published | 2015-11-11 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 10 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | unicorndev team |
| Maintainers | dmitriykharchenko |
| Keywords | event, handler, forms, buttons, angular, reflex, async |

## Links

- npm: https://www.npmjs.com/package/unicorn-ng-reflex
- Repository: https://github.com/unicorndevru/unicorn-ng-reflex
- Homepage: https://github.com/unicorndevru/unicorn-ng-reflex#readme
- Issues: https://github.com/unicorndevru/unicorn-ng-reflex/issues
- npm.io page: https://npm.io/package/unicorn-ng-reflex

## Dependencies (10)

- [del](https://npm.io/package/del.md) ^2.0.2
- [gulp](https://npm.io/package/gulp.md) ^3.9.0
- [babel](https://npm.io/package/babel.md) ^6.0.15
- [webpack](https://npm.io/package/webpack.md) ^1.12.4
- [babel-core](https://npm.io/package/babel-core.md) ^6.1.4
- [gulp-babel](https://npm.io/package/gulp-babel.md) ^6.1.0
- [gulp-rename](https://npm.io/package/gulp-rename.md) ^1.2.2
- [babel-loader](https://npm.io/package/babel-loader.md) ^6.1.0
- [babel-preset-es2015](https://npm.io/package/babel-preset-es2015.md) ^6.1.4
- [gulp-angular-filesort](https://npm.io/package/gulp-angular-filesort.md) ^1.1.1

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 0.1.1 (latest) — 2015-11-12
- 0.1.0 — 2015-11-11

## README

# unicorn-ng-reflex

A module to relief pain with async forms, buttons, etc.


### Install
```
  npm install unicorn-ng-reflex --save
```
or
```
  bower install unicorn-ng-reflex --save
```

### How to use

Forms:

```html
<reflex>
  <form reflex-submit="submitSimpleNumber(number)">
    <input
      reflex-blur="isNumberIsEven(number)"
      type="text"
      ng-model="number"/>
    <button type="submit">
      Submit
    </button>
  </form>
  <reflex-message>
  </reflex-message>
<reflex>
```
```javascript

$scope.doSomeStuff = function(number){
  return $resource.get('/checknumber', { number }).$promise
}

$scope.isNumberIsEven = function(number){
  if(number % 2 === 0){
    return true
  } else {
    return $q.reject({ messsage: 'number isn’t even'})
  }
}
```

Or just buttons:


```html
<reflex>
  <button reflex-click="checkSomething()">
    Submit
  </button>
  <reflex-message>
  </reflex-message>
<reflex>
```
```javascript

$scope.checkSomething = function(){
  return $resource.get('/checksomething').$promise
}
```


Just return promise from handler passed to one of directives: `reflex-click`, `reflex-submit`, `reflex-blur`, `reflex-keyup`, script will block button until promise is pending and broadcast events:
`unicornReflexStart` when action just happen and `unicornReflexDone` when promise is resolved or rejected.

Don't forget to wrap your elements in `<reflex>`

---
_Source: https://npm.io/package/unicorn-ng-reflex · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
