import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'turncate' }) export class TurncatePipe implements PipeTransform { transform(value: any, args?: any): any { console.log("args" + args); let limit = args.length > 0 ? parseInt(args[0], 10) : 10; let trail = args.length > 1 ? args[1] : '...'; console.log("limit" + limit); console.log("parseInt(args[0], 10)" + parseInt(args[0], 10)); console.log("trail" + trail); console.log("limit" + limit); console.log("parseInt(args[0], 10)" + parseInt(args[0], 10)); return value.length > limit ? value.substring(0, limit) + trail : value; } }