0
心中已經應用結合只有一次,但仍然得到錯誤你不能多次申請綁定到相同的元素Knockout.Js
不能多次申請綁定同一個元素。
這是我的腳本。
<script>
var self = this;
var vm = function viewModel() {
self.getAppointment = function() {
$("#dialog-confirm ").dialog({
resizable: false,
height: 250,
width: 500,
modal: true
});
self.checkAppointmentListSelect(true);
}
self.checkAppointmentListSelect = ko.observable(false);
self.btnSelectAppointmentClick = function() {
self.checkAppointmentListSelect(true);
}
debugger;
}
ko.applyBindings(vm);
</script>
這是HTML數據
<div id="dialog-confirm" title="Select Appointment">
<div class="modal-body" data-bind="visible: checkAppointmentListSelect">
<button class="btn btn-primary" id="btnSelectAppointment" data-bind="click: btnSelectAppointmentClick">Select</button>
<button class="btn btn-primary" id="btnCancel">Cancel</button>
</div>
<div class="modal-body" data-bind="visible: checkAppointmentListSelect">
<button class="btn btn-primary" id="btnSelectAppointment">Select </button>
<button class="btn btn-primary" id="btnCancel">Cancel</button>
</div>
</div>
此代碼工作正常,您可以添加您的視圖代碼示例?你有更多的地方,你叫ko.applyBindings? –
該頁面上正在使用淘汰賽的唯一地點,還是您在兩個不同區域使用了兩次? –
nope,只在此頁 –