# @zthun/identifier.angular

> The zidentifier feature for Angular6+

Latest version **2.0.2** (published 2018-10-20) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @zthun/identifier.angular
pnpm add @zthun/identifier.angular
yarn add @zthun/identifier.angular
bun add @zthun/identifier.angular
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2018-10-20 |
| First published | 2018-07-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 9.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Anthony Bonta |
| Maintainers | zthun |
| Keywords | zid, zfor, zthunworks |

## Links

- npm: https://www.npmjs.com/package/@zthun/identifier.angular
- Repository: https://github.com/zthun/zidentifier.angular
- Homepage: https://github.com/zthun/zidentifier.angular#readme
- Issues: https://github.com/zthun/zidentifier.angular/issues
- npm.io page: https://npm.io/package/@zthun/identifier.angular

## Dependencies (1)

- [@zthun/identifier.core](https://npm.io/package/@zthun/identifier.core.md) =2.0.2

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 2.0.2 (latest) — 2018-10-20
- 2.0.1 — 2018-07-24
- 2.0.0 — 2018-07-23

## README

# Description

This package is the dynamic id generator for Angular.  

See [@zthun/identifier.core](https://www.npmjs.com/package/@zthun/identifier.core) for the general problem and solution that this package attempts to solve.  

# How to Use

Install the package from npm into your project.  

```sh
npm install @zthun/identifier.angular --save
```

In your Angular main module, add the ZIdentifierModule to your list of dependencies.

```typescript
import { NgModule } from '@angular/core';
import { ZIdentifierModule } from '@zthun/identifier.angular';

@NgModule({
    bootstrap: [
        // Bootstrap code.
    ],
    declarations: [
        // Components and Directives go here.
    ],
    imports: [
        ZIdentifierModule
    ],
    providers: [
        // Injectables
    ]
})
export class MyModule { }
```

This gives you access to the zid attribute directive.  You can now dynamically generate ids based on your root component.

```html
<div id="root">
    <div zid="component">
        <div zid="child-one"></div>
        <div zid="child-two"></div>
    </div>
</div>
```

The zid attribute can be bound to context data as well.

```html
<div id="root">
    <div zid="component">
        <div *ngFor="let item of items" zid="child-{{item.id}}">
        </div>
    </div>
</div>
```

This will output the following HTML.

```html
<div id="root">
    <div id="root-component">
        <div id="root-component-child-one"></div>
        <div id="root-component-child-two"></div>
    </div>
</div>
```

You can also use this for labels.

```html
<div id="root">
    <form id="root-form">
        <label zfor="input">My Label</label>
        <input zid="input" type="text">
    </form>
</div>
```

# Contribute

You will need the source repository first.

```sh
git clone https://github.com/zthun/zidentifier.angular
```

You can also fork the repository in preparation for a pull request back to the master branch.

Once you have the repository, you can build the solution using the following commands.

```sh
npm install
npm run make
npm pack
```

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