# es6-angular-util

> ES6 angularjs utility classes

Latest version **1.1.1** (published 2016-10-01) · ISC license · 0 weekly downloads

## Install

```sh
npm install es6-angular-util
pnpm add es6-angular-util
yarn add es6-angular-util
bun add es6-angular-util
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2016-10-01 |
| First published | 2016-09-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Mike Lindenmuth |
| Maintainers | mike.lindenmuth |
| Keywords | angular, angularjs, util, utility |

## Links

- npm: https://www.npmjs.com/package/es6-angular-util
- Repository: https://gitlab.com/aquaplane/es6-angular-util
- Homepage: https://gitlab.com/aquaplane/es6-angular-util#README
- Issues: https://gitlab.com/aquaplane/es6-angular-util/issues
- npm.io page: https://npm.io/package/es6-angular-util

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 1.1.1 (latest) — 2016-10-01
- 1.1.0 — 2016-10-01
- 1.0.0 — 2016-09-19

## README

# Installation

```
npm install --save es6-angular-util
```

# Usage

## Controller

The `Controller` class adds three utility methods for $watch, $emit and $on.

```javascript
// foo.controller.js

import {Controller} from 'es6-angular-util'

export default class Foo extends Controller
{
    constructor ($scope)
    {
        super($scope);
    }
    
    bar ()
    {
        this.emit(BAR);
    }
}

export const BAR = 'Foo.BAR'
```

## Directive

The `Directive` class simplifies creating directives by passing the controller and template for assignment in the super class. 

```javascript
// foo.directive.js

import {Directive} from 'es6-angular-util'

import controller from './foo.controller'
import template from './foo.html'

export default class Foo extends Directive
{
    constructor ()
    {
        super(controller, template)
    }
}
```

The third and fourth arguments allow you to specify scope variables and the `controllerAs` value:


```javascript
// foo.directive.js

import {Directive} from 'es6-angular-util'

import controller from './foo.controller'
import template from './foo.html'

export default class Foo extends Directive
{
    constructor ()
    {
        super(controller, template, {bar: '='}, 'baz')
    }
}
```

```html
<!-- foo.html -->
{{baz.bar}}
```

```html
<!-- app.html -->

<foo bar="someBindableValue"></foo>
```

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