A View Inside My Head

Jason's Random Thoughts of Interest
posts - 86, comments - 178, trackbacks - 22

January 2012 Entries

Override toString in Knockout ViewModel

It seems that I'm always struggling to simplify my code.  As such, I was playing with Knockout today, and found that in multiple places, I needed a string containing concatenated values of multiple observables Take this simple example of binding a dropdown to a view model, and also showing the selected value in a span.  The items being bound are not simple strings, but rather, are complex objects containing multiple attributes.  The string that I ultimately want to display is a concatenation of the first and last names of the employee, but without doing anything special, the rendered text will be:...

posted @ Wednesday, January 18, 2012 12:42 PM | Feedback (0) | Filed Under [ Articles ]

Powered by: