您的位置:首页 > 移动开发

HTML5 App with MVVM and Knockout Study(2)

2012-10-06 04:36 302 查看
Study (2) Built In Bindings

Binding - Text and HTML

TEXT renders the text itself, while HTML renders with html syntax:





run the code in jsFiddle

Binding - Checkbox and Radio Button

For Radio buttons, only if the value attribute equals to the data binding parameter “checked”, KO will set the radio button to be checked, so the parameter value should be a string.

For Checkboxes, KO will set the element to be checked when the parameter value is
true
, and unchecked when it is
false
.

Read this document for details





run the code in jsFiddle

Binding - List(single and multiple)





run the code in jsFiddle

Binding - enable/disable





run the code in jsFiddle

Binding - Focus/visible





run this in jsFiddle

Binding - click and event





run the code in jsFiddle

Binding - CSS and Styling





run the code in jsFiddle

Binding – Attribute





run the code in jsFiddle
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: