blob: 8cb2e1dcd6c2df48f64a042b02f3544791015999 [file] [log] [blame]
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +03001import {PipeTransform, Pipe} from '@angular/core';
2import {isNullOrUndefined} from "util";
3
4@Pipe({ name: 'serviceInfo'})
5export class ServiceInfoPipe implements PipeTransform {
6 transform(service: string, store : any , modelId : string, fieldName : string): string {
7 const serviceHierarchy = store.getState().service.serviceHierarchy;
8 if(!isNullOrUndefined(serviceHierarchy) && !isNullOrUndefined(serviceHierarchy[modelId])){
9 return serviceHierarchy[modelId].service[fieldName] || null;
10 }
11 return null;
12 }
13}