Search code examples
javascripthtmlknockout.jswinjs

Use WinJS to bind attributes of HTML element and how to prevent knockout from binding on HTML elements ?


I know they`re two separated questions but : Is there is any way to use WinJS to Bind on attributes of an element such as ( ID , name ) .

Unfortunately I've to use Knockout data-bind (to bind on attributes ) with Winjs-data-bind (to bind on html elements ) . so is there is a way to control Knockout binding in order to prevent elements binding and allow just Attributes binding .


Solution

  • Check out http://knockoutjs.com/documentation/custom-bindings-controlling-descendant-bindings.html - in Knockout you can create some custom binding that will stop KO from binding child elements of other HTML element. Then you can run WinJS.Binding.processAll on all child elements and it won't interfere with KO bindings.