File

libs/ngx-pfe/pfe-conditions/conditions.module.ts

import { NgModule, Provider } from '@angular/core';
import { PfeConditionsServiceImpl } from './conditions.service.impl';
import { PfeConditionsService } from './conditions.service';
import { CONDITIONS_EVALUATORS } from './condition-evaluator.model';
import { pfeAndConditionEvaluator } from './and/and.factory';
import { pfeOrConditionEvaluator } from './or/or.factory';
import { pfeExpressionEvaluator } from './expression/expression.factory';

const DEFAULT_CONDITIONS_EVALUATOR: Provider[] = [
  {
    provide: CONDITIONS_EVALUATORS,
    multi: true,
    useFactory: pfeExpressionEvaluator,
  },
  {
    provide: CONDITIONS_EVALUATORS,
    multi: true,
    useFactory: pfeAndConditionEvaluator,
    deps: [PfeConditionsService],
  },
  {
    provide: CONDITIONS_EVALUATORS,
    multi: true,
    useFactory: pfeOrConditionEvaluator,
    deps: [PfeConditionsService],
  },
];

@NgModule({
  providers: [
    {
      provide: PfeConditionsService,
      useClass: PfeConditionsServiceImpl,
    },
    DEFAULT_CONDITIONS_EVALUATOR,
  ],
})
export class PfeConditionsModule {}

results matching ""

    No results matching ""