File

src/app/modules/shared/pipes/cdnprefix.pipe.ts

Metadata

Methods

transform
transform(value: any)
Parameters :
Name Type Optional
value any No
Returns : any

Properties

cdnBaseUrl
Type : string
Default value : (<HTMLInputElement>document.getElementById('cdnUrl')) ? (<HTMLInputElement>document.getElementById('cdnUrl')).value : ''
import { Pipe, PipeTransform } from '@angular/core';
import * as _ from 'lodash-es';

@Pipe({
  name: 'cdnprefixurl'
})
export class CdnprefixPipe implements PipeTransform {
  cdnBaseUrl: string = (<HTMLInputElement>document.getElementById('cdnUrl')) ?
    (<HTMLInputElement>document.getElementById('cdnUrl')).value : '';
  transform(value: any): any {
    if (_.startsWith(value, 'assets/')) {
      return this.cdnBaseUrl + value;
    }
    return value;
  }

}

results matching ""

    No results matching ""