import { Pipe , PipeTransform } from '@angular/core' ; import { ApiService } from 'app/api.service' ; @ Pipe ( { name : 'addNodeUrl' } ) export class AddNodeUrlPipe implements PipeTransform { nodeUrl = '' ; constructor ( private apiService ) { this . nodeUrl = this . apiService . nodeUrl ; } transform ( value ) { if ( value && value . startsWith ( '/' ) ) { value = value . substr ( 1 , value . length ) ; } return value && `${ this . nodeUrl }/${ value }` ; } }