In my application I'm binding data from an API to a ul
successfully. However, I'm unable to have KO call the function bound to the click event of an a
tag. I got below error:
Uncaught Error: Unable to parse bindings.
Message: ReferenceError: loadContact is not defined;
Bindings value: click: loadContact,attr: { title: 1}
View code:
<ul data-role="listview" id="ListSss" data-divider-theme="b" data-inset="true">
<li data-role="list-divider" role="heading">
Criteria Selected
</li>
<!-- ko foreach: Contacts -->
<li data-theme="c">
<a href="#" data-transition="slide" data-bind="click: loadsss,attr: { title: sss }">
<span data-bind="text: FName + ' ' + LName + ' (' + Classifiy +':'+ Position+ ')'" ></span>
</a>
</li>
<!-- /ko -->
</ul>
JS code:
self.loadsss = function () {
alert("hi");
}
Because of href link present in foreach thats why I'm unable to fire click event of href? Where did I make a mistake?