swimlane / ngx-datatable

✨ A feature-rich yet lightweight data-table crafted for Angular
http://swimlane.github.io/ngx-datatable/
MIT License
4.63k stars 1.68k forks source link

Put pipe inside emptyMessage #589

Open romanovma opened 7 years ago

romanovma commented 7 years ago

I'm submitting a ... (check one with "x")

[ ] bug report => search github for a similar issue or PR before submitting
[ x ] feature request
[ ] support request => Please do not submit support request here

Current behavior I want to translate the emptyMessage. Normally we use https://github.com/ngx-translate/core module to do translation so I put `{{ key | translate }} werever I want. I tried to find the way to pass this into emptyMessage property but it didn't work (I suppose because of https://github.com/swimlane/ngx-datatable/blob/a63a0ace4d6ab53b5b67144cd83f5471f1aa0584/src/components/body/body.component.ts#L55).

Expected behavior Is there any way to handle this? May be through ngx-datatable-body-template?

Reproduction of the problem

What is the motivation / use case for changing the behavior? I actually can use https://github.com/ngx-translate/core#4-use-the-service-the-pipe-or-the-directive but it will be more consistent from my side to use pipes everywhere. Not a big deal anyway. Just asking.

Please tell us about your environment:

Poledouris commented 7 years ago

Just implemented this a couple of days ago. I was able to use the pipe like this:

[messages]="{emptyMessage: 'NODATA' | translate, totalMessage: 'TOTAL' | translate, selectedMessage: false}"

That works on 7.1.1 and 9.1.0. It's a little different than other areas, but it works. This is using ngx-translate also.

julkue commented 3 years ago

@Poledouris This doesn't work with Angular's built-in i18n directive.