Sonsino, Ofir (os0695) | ff76b5e | 2018-07-10 15:57:37 +0300 | [diff] [blame^] | 1 | import {PipeTransform, Pipe} from '@angular/core'; |
| 2 | import {isNullOrUndefined} from "util"; |
| 3 | |
| 4 | @Pipe({ name: 'serviceInfo'}) |
| 5 | export 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 | } |