summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/pipes/serviceInfo/serviceInfo.pipe.ts
blob: 2876362e2bba3f0558aea6d8399160ec4bf79fce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import {PipeTransform, Pipe} from '@angular/core';
import * as _ from 'lodash';

@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(!_.isNil(serviceHierarchy) && !_.isNil(serviceHierarchy[modelId])){
      return serviceHierarchy[modelId].service[fieldName] || null;
    }
    return null;
  }
}