Data-binding options:
Example:
In this example, the ViewModel is defined specifically for use with the wizard. It has a seriesList property that is bound in the View. If this value changes, the widgets automatically respond. The widgets also update the ViewModel values.
Create a ViewModel:
ViewModel Script |
Copy Code |
---|---|
var viewModel = function () { var self = this; self.disabled = ko.observable(false); self.navButtons = ko.observable(false); self.autoPlay = ko.observable("show"); self.delay = ko.observable("hide"); self.loop = ko.observable(false); self.backBtnText = ko.observable("show"); self.nextBtnText = ko.observable("hide"); }; |
Create View with Bound Controls:
View Markup |
Copy Code |
---|---|
<div id="wizard" data-bind="wijwizard: { disabled: disabled, navButtons: navButtons, autoPlay: autoPlay, delay: delay, loop: loop, backBtnText: backBtnText, nextBtnText: nextBtnText}"> </div> |