I have this observable array in my view model.
this.months = ko.observableArray(['Jan', 'Feb', 'Mar',...]);
If I try to display each month, like this -
<!-- ko foreach: { data: months, as: 'month' } -->
<span data-bind="text: month"></span>
<!-- /ko -->
It throws an error -
Uncaught ReferenceError: Unable to process binding "text: function (){return month }"
Message: month is not defined
If I try this,
<!-- ko foreach: months -->
<span data-bind="text: $data"></span>
<!-- /ko -->
it displays [object object]
What am I doing wrong?
Thanks.