是否有任何基因敲除页面/路由框架? [英] Are there any knockoutjs page/routing frameworks?

查看:89
本文介绍了是否有任何基因敲除页面/路由框架?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自asp.net MVC3.在MVC4中,他们引入了WebAPI.能够在javascript中执行所有视图/路由代码,并且仅依赖于MVC作为API,这将是很好的.可以独立于IIS运行webapi真是太酷了!

Coming from asp.net 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.

这篇关于是否有任何基因敲除页面/路由框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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