我的点击绑定没有调用 fullName 函数什么是正确的调用方式?
<div>
<div data-bind="with: test.name" >
<div>
<span data-bind="text:firstName"></span>
<span data-bind="text:firstName"></span>
<br />
<div>
<span data-bind="click: $parent.fullName">FullName</span>
</div>
</div>
modal = function(){
var firstName = ko.observable('jhon'),
lastName = ko.observable('deo'),
test = {
name : {
firstName: firstName,
lastName: lastName
},
fullName : function(){
alert(name.firstName() + name.lastName());
}
};
return {
test: test
}
}();
ko.applyBindings(modal);