1.0.2 • Published 7 years ago

@vendasta/partner-service v1.0.2

Weekly downloads
10
License
ISC
Repository
-
Last release
7 years ago

Partner Service

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

Requirements

The Partner Service interface:

export interface PartnerServiceInterface {
  getPartnerId(): Observable<string>;
}

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

…
import {PartnerServiceInterface} from '@vendasta/partner-service';

@Injectable()
export class PartnerService implements PartnerServiceInterface {
  …
  getPartnerId(): Observable<string> {
    // Implement how the project determines which partner id the current context is in
  }
}

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

import { PartnerService } from './partner.service';
import { PartnerServiceInterfaceToken } from '@vendasta/partner-service';
…
@NgModule({
  …
  providers: [
    PartnerService, {provide: PartnerServiceInterfaceToken, useExisting: PartnerService}
  ],
})
  • Note: To be able to inject an interface, you will have to provide the InjectionToken and not the interface itself (PartnerServiceInterfaceToken vs PartnerServiceInterface).