knockoutjs $index is not working in mapping plungin
-
12-12-2019 - |
Domanda
I am using asp.net mvc 3 and knockoutjs 2.0 and mapping plugin I have converted my model as json as below using mapping plugin
viewModel=ko.mapping.fromJS(@Html.Raw(Html.Serialize(Model)));
<div class="orders">
<div data-bind="foreach: JobOrder">
<div data-bind="text:$index">
</div>
</div>
</div>
my model is
public class Jobs : EntityBase
{
[MLLAttr(ObjectType = MLLObjectType.Child, IsCreate = true, ParentName = "Jobs", IsRequired = true)]
public List<JobOrder> JobOrder { get; set; }
}
$index is not working.
Thanks in advance
Soluzione
As Michael pointed out, $index
was introduced in knockout 2.1. You will need to update to use it
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow