to $routeProvider or $stateProvider

前端 未结 2 1545
误落风尘
误落风尘 2021-02-03 20:12

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

It appears as if $routeProvider is soon going to be discontinued and replace with $

2条回答
  •  悲&欢浪女
    2021-02-03 20:41

    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.

提交回复
热议问题