1
votes

I'm using knockout with a foreach loop, and my specific element i want to bind the text element of a span to an anonymous function, however there is just a string version of the function returned <span data-bind="text: function(ri) { ri.itemNameAndRateplan() + ' ' + ri.Adults(); }"></span>

when run returns function (ri){ ri.itemNameAndRateplan() +' '+ ri.Adults();} as the html for the element. I would expect it to be something like ratePlanNameValue 4

How do i fix this?

1

1 Answers

2
votes

You can actually just write data-bind="text: ri.itemNameAndRateplan() +' '+ ri.Adults()" If ri is an observable, add (). If this isn't the case I'd need to see some more code.