This package has been deprecated

Author message:

Moved to @vendasta/core

@vendasta/taxonomy-service
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

Taxonomy Service

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

Requirements

The Taxonomy Service interface:

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:


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)

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).

Readme

Keywords

none

Package Sidebar

Install

npm i @vendasta/taxonomy-service

Weekly Downloads

1

Version

2.0.2

License

ISC

Last publish

Collaborators

  • vendasta