src/app/modules/shared/pipes/cdnprefix.pipe.ts
Name | cdnprefixurl |
transform | ||||||
transform(value: any)
|
||||||
Parameters :
Returns :
any
|
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;
}
}