2

Normally with KnockoutJs you would have something like this:

    <input type="text" name="Capital" id="Capital" data-bind="value: capital">

During the binding, we would create an observable:

   this.capital = ko.observable(100);

But let's say that we cannot add the data-bind attribute. Also not after page is loaded..and after that.. never.

How would we be able to bind to our viewmodel using Knockout ?

4

1 回答 1

0

如果您不想将data-bind标记添加到元素,则需要编写自己的自定义 bindingProvider 以允许您在 javscript 中编写绑定,或者您可以使用Knockout.Unobtrusive插件,它为您提供此功能。

于 2012-10-29T08:44:47.643 回答