diff options
Diffstat (limited to 'vid-webpack-master/src/app/shared/pipes/capitalize/capitalize-and-format.pipe.ts')
-rw-r--r-- | vid-webpack-master/src/app/shared/pipes/capitalize/capitalize-and-format.pipe.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/vid-webpack-master/src/app/shared/pipes/capitalize/capitalize-and-format.pipe.ts b/vid-webpack-master/src/app/shared/pipes/capitalize/capitalize-and-format.pipe.ts new file mode 100644 index 000000000..e3ec9ae9a --- /dev/null +++ b/vid-webpack-master/src/app/shared/pipes/capitalize/capitalize-and-format.pipe.ts @@ -0,0 +1,12 @@ +import {PipeTransform, Pipe} from '@angular/core'; + +@Pipe({ name: 'capitalizeAndFormat' }) +export class CapitalizeAndFormatPipe implements PipeTransform { + transform(text: string): string { + if (text) { + text = text.toLowerCase().replace('_', '-'); + return text.charAt(0).toUpperCase() + text.slice(1); + } + return text; + } +} |