用Knockoutjs创建动态UI.docxVIP

  1. 1、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
  4. 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
  5. 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们
  6. 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
  7. 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
用Knockoutjs创建动态UI

 HYPERLINK /r01cn/archive/2012/11/15/2771264.html 【ASP.NET Web API教程】2.3.5 用Knockout.js创建动态UI 注:本文是【 HYPERLINK /r01cn/archive/2012/11/11/2765432.html ASP.NET Web API系列教程】的一部分,如果您是第一次看本博客文章,请先看前面的内容。 Part 5: Creating a Dynamic UI with Knockout.js 第5部分:用Knockout.js创建动态UI 本文引自:/web-api/overview/creating-web-apis/using-web- api-with-entity-framework/using-web-api-with-entity-framework,-part-5 Creating a Dynamic UI with Knockout.js 用Knockout.js创建动态UI In this section, well use Knockout.js to add functionality to the Admin view. 在本小节中,我们将用Knockout.js对Admin视图添加功能。  HYPERLINK / Knockout.js is a Javascript library that makes it easy to bind HTML controls to data. Knockout.js uses the Model-View-ViewModel (MVVM) pattern.  HYPERLINK / Knockout.js是一个JavaScript库,它让HTML控件很容易与数据进行绑定。Knockout.js使用的是“模型-视图-视图模型(MVVM)”模式。 The model is the server-side representation of the data in the business domain (in our case, products and orders). 模型是事务域中数据的服务器端表示(在我们的示例中,是产品和订单)。 The view is the presentation layer (HTML). 视图是表现层(HTML)。 The view-model is a Javascript object that holds the model data. The view-model is a code abstraction of the UI. It has no knowledge of the HTML representation. Instead, it represents abstract features of the view, such as a list of items. 视图模型是保存了模型数据的一个JavaScript对象。视图模型是UI的一种代码抽象。它没有HTML表示方面的知识,但它表现了视图的抽象特性,如“列表项”。 The view is data-bound to the view-model. Updates to the view-model are automatically reflected in the view. The view-model also gets events from the view, such as button clicks, and performs operations on the model, such as creating an order. 视图是与视图模型数据绑定的。对视图模型的更新会自动地在视图得到反映。视图模型也会获取视图的事件,如按钮点击,并在模型上执行操作(见图2-23)。 图2-23. 模型-视图-视图??型之间的关系 First well define the view-model. After that, we will bind the HTML markup to the view-model. 首先,我们要定义视图模型。之后,要将HTML标记与视图模型进行绑定。 Add the following Razor section to Admin.cshtml: 对Admin.cshtml添加以下Razor片段: @section Scripts { @Scripts.Render(~/bundles/jqueryval) script type=text/javascript src=@Url.Cont

文档评论(0)

2017ll + 关注
实名认证
文档贡献者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档