ng2-table
ng2-table copied to clipboard
Allow user to specify property 'pipe' on column object to allow for custom formatting pipes
What this will allow users to do is create a pipe object in their component and set the pipe property on their column:
columns:Array<any> = [
{title: 'My Column Title', name: 'columnName', pipe: new MyPipe()}
]
For pipes like CurrencyPipe that take parameters, the user can make their own pipe that extends CurrencyPipe and pass the desired parameters. For example:
import { Pipe, PipeTransform, Injectable } from '@angular/core';
import { CurrencyPipe } from '@angular/common';
@Pipe({
name: 'usd',
pure: 'false'
})
@Injectable()
export class USDPipe extends CurrencyPipe {
constructor() {
super("en-US");
}
public transform(money:number):string {
return super.transform(money, "USD", true);
}
}
I believe this is what #250 is asking for.
👍
would like to see this feature coming into a next version
Can this be merged?
When shall we be able to benefit from this feature ?
Hi guys, any example of this feature? I have problems to apply date pipe.