Creating a custom pipe to show currency symbols

Rachid shows us how to create a customize pipe to show Euro symbol in NativeScript.

    import {PipeTransform, Pipe} from '@angular/core';
    import { DecimalPipe } from '@angular/common';
    export class  CurrencyEuroPipe implements PipeTransform {
        transform(value, args): string{
             let pipe = new DecimalPipe('');
             return '€'+pipe.transform(value, "3.2");

  • I was trying to show a Euro symbol (€) in my application using Angular's  default pipe , however this did not work as expected and kept showing the dollar symbol ($) on NativeScript. To go around this, I created my own pipe, by injecting (DecimalPipe) pipe then customizing it. 
    Finally I used the customized pipe in my .xml file . Hope this can be useful to anyone who needs it.