aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/pipes/serviceInfo/serviceInfo.pipe.ts
blob: 8cb2e1dcd6c2df48f64a042b02f3544791015999 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import {PipeTransform, Pipe} from '@angular/core';
import {isNullOrUndefined} from "util";

@Pipe({ name: 'serviceInfo'})
export class ServiceInfoPipe implements PipeTransform {
  transform(service: string, store : any , modelId : string, fieldName : string): string {
    const serviceHierarchy = store.getState().service.serviceHierarchy;
    if(!isNullOrUndefined(serviceHierarchy) && !isNullOrUndefined(serviceHierarchy[modelId])){
      return serviceHierarchy[modelId].service[fieldName] || null;
    }
    return null;
  }
}