Activity Forums Salesforce® Discussions How to create custom Pipes in Angular 2 ?

  • Manpreet

    Member
    April 16, 2018 at 6:36 am

    Hi Amresh,

    You can create a custom pipe in a following manner :

    import {
    Pipe,
    PipeTransform
    } from '@angular/core';
    @Pipe({
    name: 'name of pipe used in markup'
    })
    export class NameofClass implements PipeTransform {
    transform(value: string, args: string[]): any {
    //Play with value and argument and return the result
    return value;
    }
    }

    // This is just a sample script. Paste your real code (javascript or HTML) here.

    if ('this_is' == /an_example/) {
    of_beautifier();
    } else {
    var a = b ? (c % d) : e[f];
    }

    Thanks.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos

Salesforce Integration Tutorial | Integrate Salesforce with Apps

Video in

This "𝐒𝐚𝐥𝐞𝐬𝐟𝐨𝐫𝐜𝐞 𝐈𝐧𝐭𝐞𝐠𝐫𝐚𝐭𝐢𝐨𝐧 𝐓𝐮𝐭𝐨𝐫𝐢𝐚𝐥" video by Edureka will help you understand what is Salesforce integration in detail. It will also address the various Salesforce integration…