File

src/pipes/category-pipe/category-pipe.ts

Metadata

Methods

transform
transform(key: string, category: string, fields?: string | any)
Parameters :
Name Type Optional
key string No
category string No
fields string | any Yes
Returns : string
import { Pipe, PipeTransform } from '@angular/core';
import { CommonUtilService, OnboardingConfigurationService } from '@app/services';


@Pipe({
    name: 'category',
    pure: true
})
export class CategoryPipe implements PipeTransform {
    constructor(
        private commonUtilService: CommonUtilService,
        private onboardingConfigurationService: OnboardingConfigurationService

    ) {
    }

    transform(
        key: string,
        category: string,
        fields?: string | any): string {
        const translationKey = this.onboardingConfigurationService.getCategoryTranslationKey(category)
        const translation = this.commonUtilService.translateMessage(translationKey)
        if(!key) {
            return translation
        }
        const lblTranslation = this.commonUtilService.translateMessage(key, fields)
        return lblTranslation.replace("{{category}}", translation);
    }

}

results matching ""

    No results matching ""