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