- 1
- 0
- 约1.24万字
- 约 12页
- 2017-07-08 发布于湖北
- 举报
第九章:⾼级应⽤举例
1 Contacts editor
这个例⼦和微软为演⽰j Query Data Linking Proposal例⼦提供的例⼦⼀样的提供的,我
们可以看看Knockout实现是难了还是容易了。
代 量的多少不重要 (尽快Knockout 的实现很简洁),重要的看起来是否容易理解且
可读。查看HTML源代 ,看看如何实现的view model 以及绑定的。
代码: View
h2Contacts/h2
div id=contactsList data-bind=template: contactsListTemplate
/div
script type=text/html id=contactsListTemplate
table class=contacts ditor
tr
thFirst name/th
thLast name/th
thPhone numbers/th
/tr
{{each(i, contact) contacts()}}
tr
td
input data-bin
原创力文档

文档评论(0)