Knockout JS One Time Bind Observable

Only one time bind observable


ko.bindingHandlers.oneTimeStyle = {
    init: function () {
        ko.bindingHandlers.style.update.apply(this, arguments);
    }
};

var viewModel = {
    name: ko.observable("red")
};

ko.applyBindings(viewModel);
<input type="text" data-bind="value: name" placeholder="Color name" />
<div data-bind="style: { color: name }">test</div>
<div data-bind="oneTimeStyle: { color: name }">test</div&gt


Knockout JS One Time Bind Observable Knockout JS One Time Bind Observable Reviewed by Bhaumik Patel on 7:36 PM Rating: 5