src/app/core/algolia/algolia.module.ts
Properties |
applicationId |
applicationId:
|
Type : string
|
Defined in src/app/core/algolia/algolia.module.ts:7
|
indexName |
indexName:
|
Type : string
|
Defined in src/app/core/algolia/algolia.module.ts:9
|
searchApiKey |
searchApiKey:
|
Type : string
|
Defined in src/app/core/algolia/algolia.module.ts:8
|
import { NgModule, ModuleWithProviders, InjectionToken } from '@angular/core';
import { CommonModule } from '@angular/common';
import { AlgoliaService } from './algolia.service';
import { ALGOLIA_APPLICATION_ID, ALGOLIA_SEARCH_API_KEY, ALGOLIA_INDEX } from './injection-tokens';
export interface AlgoliaConfiguration {
applicationId: string;
searchApiKey: string;
indexName: string;
}
@NgModule({
providers: [AlgoliaService]
})
export class AlgoliaModule {
static forRoot(config: AlgoliaConfiguration): ModuleWithProviders {
return {
ngModule: AlgoliaModule,
providers: [
{
provide: ALGOLIA_APPLICATION_ID,
useValue: config.applicationId
},
{
provide: ALGOLIA_SEARCH_API_KEY,
useValue: config.searchApiKey
},
{
provide: ALGOLIA_INDEX,
useValue: config.indexName
}
]
};
}
}