• #27009
    Forcetalks

    How to create custom Pipes in Angular 2 ?

    How to Create custom Pipes in Angular 2 ?

    Tagged: , , ,

    #27498
    Salesforce | Manpreet Manpreet #2
    Forcetalks

    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.

Viewing 2 posts - 1 through 2 (of 2 total)

Please to reply to this topic.

CONTACT US

We're not around right now. But you can send us an email and we'll get back to you, asap.

Sending

About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2018 Forcetalks. All Right Reserved.

Log in with your credentials

or    

Forgot your details?