至$ routeProvider或$ stateProvider [英] to $routeProvider or $stateProvider

查看:109
本文介绍了至$ routeProvider或$ stateProvider的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找一个声音回答这个两难困境,以routeProvider或不。

I have been looking for a sound answer to to this dilema, to routeProvider or not to.

看起来好像$ routeProvider是很​​快就要停药并以$ stateProvider取代不幸的是我不知道这种说法的准确性加stateProvider仍然只能通过ui_router插件。

It appears as if $routeProvider is soon going to be discontinued and replace with $stateProvider unfortunately I don't know the accuracy of this statement plus stateProvider is still only available via ui_router plugin.

是添加stateProvider作为AngularJS核心的一部分,该计划?被保存的假设,它很快将取代旧的$ routeProvider?

Is the plan to add stateProvider as part of the AngularJS Core? Is it save to assume that it will soon replace the old $routeProvider?

他们肯定不打的很好,而迁移CI,我在github上发现不起作用,缺乏文档。

They certainly don't play well together and the migration CI that I found in github doesn't work and lacks documentation.

推荐答案

在很长一段时间,我们决定硬着头皮从迁移到1.1.1 1.2。同时,我们意识到有限$ routerProvider真的是怎么所以,我们使用的UI路由器。到目前为止,我们喜欢它,它可以让你做一些复杂的嵌套在视图中加添加一些结构,你的应用程序,例如,在$ stateProvider您可以定义的OnEnter和onExit它允许你修改数据,并恢复它在退出,也可以transitionTo状态,这是非常强大的。我将投票支持UI路由器是折角核心的一部分,甚至替换$ routeProvider。我希望这有助于你做了你的心。 $ routeProvider仍然有效,如果你有一个基本的应用程序或演示页。

After a very long time we decided to bite the bullet and migrate from 1.1.1 to 1.2. At the same time we realized how limited $routerProvider really is so we went with ui-router. So far, we love it, it allows you to do some complex nesting in the views plus add a bit more structure to your app, for example, in $stateProvider you can define onEnter and onExit which allows you to modify your data and restore it upon exiting, you can also transitionTo state which is extremely powerful. I would vote for ui-router to be part of Angular core and even replace $routeProvider. I hope this helps you made up your mind. $routeProvider still works, if you have a basic app or demo page.

这篇关于至$ routeProvider或$ stateProvider的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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