question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature: valueFormatting Method Passed Component Data

See original GitHub issue

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

Sometimes the value passed to valueFormatting might require access to the controller data. For example, if you need to indicate a ratio, and need the denominator, but the valueFormatting method only passes the value for the numerator and nothing for the denominator. This would allow formatting for value 6 out of 20 as 6/20. You can’t add /20 to units as they won’t align properly.

  • Angular version: 4.x.x

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
marjan-georgievcommented, Apr 1, 2019

have you tried doing the binding in the component and just passing the bound function in the template? Not sure if that would improve it but it might.

Component:

this.boundCustomFunction = this.customFunction.bind(this)

then in template:

[valueFormatting]="boundCustomFunction"
2reactions
marjan-georgievcommented, Oct 3, 2017

You need to bind the function like this

[valueFormatting]="customFunction.bind(this)"

Then you will have access to the controller’s properties and methods inside it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Format the value of a Ngx gauge chart to display a percentage
Can anyone explain how to use the valueFormatting function? I have attached the HTML code, data for the graph and snapshot of the...
Read more >
Value formatting in keyvaluemap components - Retool Forum
Hi - I've written a transformer using JSON.stringify to nicely format a JSON object. But when it's passed to a Key Value Map...
Read more >
Value Formatting: DevExtreme - JavaScript UI ... - DevExpress
Set the format UI component property to apply a predefined format. ... The value to be formatted is passed to the function as...
Read more >
Element: <oj-chart> - Oracle
The SVG DOM that this component generates should be treated as a black ... enabled, The time value for each data item is...
Read more >
ag-Grid Components: Cell Renderers
The same params that are passed to the cellRenderer function. init? ... 'Days of Air Frost' column uses the Component method to format...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found