Wijmo User Guide > Concepts > Knockout > Two-Way Live Binding > KO InputNumber Binding |
Data-binding options:
Example:
In this example, the ViewModel is defined specifically for use with the input number. It has val, min, max, and disabled properties that are bound in the View. If any of these values change, the widgets automatically respond to them. The widgets also update the ViewModel values as they modify them.
Create a ViewModel:
ViewModel Script |
Copy Code
|
---|---|
var viewModel = function () { var self = this; self.val = ko.observable(50); self.min = ko.observable(0); self.max = ko.observable(100); self.disabled = ko.observable(false); }; |
Create View with Bound Controls:
View Markup |
Copy Code
|
---|---|
<input data-bind="wijinputnumber: { value: val, minValue: min, maxValue: max, disabled: disabled}" /> |