MVC 4 - 更优雅的方式来编辑商品的可变长度的名单? [英] MVC 4 - More Elegant way to Edit Variable-Length List of Items?

查看:165
本文介绍了MVC 4 - 更优雅的方式来编辑商品的可变长度的名单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找到了编辑项目的可变长度列表中的最好的建议是为ASP.Net MVC 2在2008年写的。

The best advice I found for editing a variable-length list of items was written for ASP.Net MVC 2 in 2008.

<一个href=\"http://blog.stevensanderson.com/2008/12/22/editing-a-variable-length-list-of-items-in-aspnet-mvc/\">http://blog.stevensanderson.com/2008/12/22/editing-a-variable-length-list-of-items-in-aspnet-mvc/

时的这一做法仍然是ASP.Net MVC 4最好的一个,或者是有要么是标准化的,或者更优雅的一个较新的解决方案吗?

Is that approach still the best one for ASP.Net MVC 4, or is there a newer solution that is either standardized, or more elegant?

推荐答案

看看 http://knockoutjs.com/ 这是一个JavaScript框架,它依赖于MVVM模式。基本上你可以将数据绑定阵列型号到HTML,然后张贴早在JSON阵列控制器。一个伟大的副作用是,它有助于让你的控制器的更多单元测试友好(因为你的控制器主要返回JSON)。

Take a look at http://knockoutjs.com/ it's a JavaScript framework that relies on the MVVM pattern. Basically you can data-bind array models to your HTML and then post them back as JSON arrays to your controller. One great side-effect is that it helps to make your controllers more unit-test friendly (because your controllers mainly return JSON).

有在 http://channel9.msdn.com/Events约击倒一个伟大的视频/ MIX / MIX11 / FRM08

基本上你想了解一下什么是观察到的阵列。 http://knockoutjs.com/documentation/observableArrays.html

Basically what you want to look at is observable arrays. http://knockoutjs.com/documentation/observableArrays.html

我也强烈建议您观看knockout.js 20分钟的视频介绍。虽然这是一个较旧的视频它给你它是如何工作是个好主意,这对我帮助很大。
http://channel9.msdn.com/Events/MIX/MIX11/FRM08

I would also highly recommend you watch the 20 minute video introduction on knockout.js. Even though it's an older video it gives you a good idea of how it works, it helped me a lot. http://channel9.msdn.com/Events/MIX/MIX11/FRM08

您也可以使用AngularJS http://angularjs.org/ 这是同一个概念(MVVM),它是由谷歌推出。有很多的两个,但最重要的一(我注意到ATLEAST)在角上有模板更依赖,在很多方面它赋予了它更多的权力之间的差异。

You can also use AngularJS http://angularjs.org/ which is the same concept (MVVM), it is put out by google. There are a lot of differences between the two but the most major one (I noticed atleast) is in angular there is more reliance on templating, in a lot of respects it gives it more power.

在这两者之间,我认为淘汰赛更容易启动和运行,但你有AngularJS更多的选择。

Between the two I think knockout is easier to get up and running but you have more options with AngularJS.

这篇关于MVC 4 - 更优雅的方式来编辑商品的可变长度的名单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆