# @vendasta/taxonomy-service

> Taxonomy Service for frontend components to use.

Latest version **2.0.2** (published 2017-06-21) · ISC license · 0 weekly downloads

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

## Install

```sh
npm install @vendasta/taxonomy-service
pnpm add @vendasta/taxonomy-service
yarn add @vendasta/taxonomy-service
bun add @vendasta/taxonomy-service
```

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2017-06-21 |
| First published | 2017-06-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+8 in 1 direct dependencies) |
| Install scripts | no |
| Author | Vendasta R&D |
| Maintainers | vendasta |

## Links

- npm: https://www.npmjs.com/package/@vendasta/taxonomy-service
- npm.io page: https://npm.io/package/@vendasta/taxonomy-service

## Dependencies (4)

- [rxjs](https://npm.io/package/rxjs.md) ^5.0.0
- [core-js](https://npm.io/package/core-js.md) ^2.0.0
- [zone.js](https://npm.io/package/zone.js.md) ^0.8.0
- [@angular/core](https://npm.io/package/@angular/core.md) ^4.0.0

## Recent versions

- 2.0.2 (latest) — 2017-06-21
- 2.0.1 — 2017-06-14
- 2.0.0 — 2017-06-14

## README

# Taxonomy Service

This provides a service for other components to use to retrieve taxonomy information.

## Requirements

The Taxonomy Service interface:

```typescript
export interface TaxonomyOption {
  name: string;  // The name of the taxonomy option
  fullName: string;  // The full name of the taxonomy option, including parent taxonomies
  id: string;  // The id that represents this taxonomy option
}

export interface TaxonomyServiceInterface {
  getTaxonomyIds(): Observable<TaxonomyOption[]>;
}
```

To implement the interface make a new service that implements the interface:

```typescript
…
import {TaxonomyServiceInterface} from '@vendasta/taxonomy-service';

@Injectable()
export class TaxonomyService implements TaxonomyServiceInterface {
  …
  getTaxonomyIds(): Observable<string[]> {
    // Implement how the project determines taxonomy ids
  }
}
```

Next you will need to provide your service as that interface (generally in `app.module.ts`)

```typescript
import { TaxonomyService } from './taxonomy.service';
import { TaxonomyServiceInterfaceToken } from '@vendasta/taxonomy-service';
…
@NgModule({
  …
  providers: [
    TaxonomyService, {provide: TaxonomyServiceInterfaceToken, useExisting: TaxonomyService}
  ],
})
```

* Note: To be able to inject an interface, you will have to provide the InjectionToken and not the interface itself (`TaxonomyServiceInterfaceToken` vs `TaxonomyServiceInterface`).

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