来自asp MVC3.在MVC4中,他们引入了WebAPI.能够在javascript中执行所有视图/路由代码,并且仅依赖于MVC作为API,这将是很好的.可以独立于IIS运行webapi真是太酷了!
Coming from asp MVC 3. In MVC4 they introduced WebAPI's. It would be nice to be able to do all view/routes code in javascript and just rely on MVC for API. Heck it's really cool that webapi's can be run independent of IIS!
话虽这么说
是否存在任何可以利用KnockoutJS的页面框架,这些框架与下面的我的模型类似:
Are there any page frameworks that can leverage KnockoutJS which are similar to my mock-up below:
Framework.RegisterRoutes(..,mainViewModel);//sets the CurrentViewModel?每个路由都是viewModel的一个单独文件,一个视图将被注入到主视图中
Each route being a separate file of a viewModel, and a view to be injected into the master view
var mainviewModel= function(){ var self = this; self.CurrentViewModel = ko.observable(); ... return self; } <div id="mainPageContent" data-bind:'html:CurrentViewModel.Render'> </div>我知道很多可以通过自我实现,但是不确定如何实现注册路由/加载单独的文件
I know that a lot of this can be achieved by self, but not sure how to achieve the register routes/ loading separate files
我觉得基因敲除js的主要优势是不干扰您编写js的方式的能力(即,只要观察到交互对象,便可以按照您想要的方式构建对象/框架)
I feel like knockoutjs's main strengths is the ability to not intrude into the way you code js (ie build an object/framework how you want so long as the interacting objects are observable)
推荐答案Pager.js 是专门为与Knockout结合使用而构建的URL路由框架.js.确保您遍历整个演示以了解其全部功能和灵活性.恕我直言,它远远超过了PathJS和Sammy.
Pager.js is a URL routing framework built specifically for use with Knockout.js. Make sure you go through the entire Demo to see its full power and flexibility. IMHO, it far exceeds PathJS and Sammy.
更多推荐
是否有任何基因敲除页面/路由框架?
发布评论