Dynamic value converters – Less code, more functionality
As we said at the beginning of this chapter, our application should be available for all the users worldwide. You are completely free to model the application according to your own purposes. Maybe you want to implement premium features that would need you to pay to access them, so you will need to express the cost in the user currency. Another good thing could be to have a custom formatted date, or simply add some number conversion, decimal rounds, and so on.
You already know how to bind and interpolate values between Aurelia View
and ViewModel
components. Now we will see how to improve that data binding. Come on!
The problem – Data is not exposed as we need
One of the common problems we could have is the date formatting. In other code languages such as Java, you have a utility class like SimpleDateFormat
, which converts the Date()
object to a more friendly human reading format. In JavaScript, we have some libraries to do that job, but...