ui router vs ngroute for sinlge page app

I am starting a new angular project(a single page app), which will have complex views (dialogs, wizards, popups, loaders), though exact requirements are not so clear at the moment.

Should I use ui.router upfront ? Or should I begin with ngRoute and change to ui.router when needed ?

What benefit ui.router has over ngRoute ? What are the limitations that may make me to opt for ui.router instead ?

From my research it seems ui.router does lot more than ngRoute, I would try to avoid the complexity as long as possible.

I read What is the difference between angular-route and angular-ui-router?, but doesnt really help (me being a total angular noob).

I have fine skills in js,jquery,html though.


I suggest go ahead with ui.router, why ?

  • its almost as complex as ngRoute

  • it will better allow you to use same view in a page, popup, or container within another page

  • more readable code

    /book/{{book.name}}/chapter/{{chapter.name}}

    vs

    book.chapter({chapter : chapter.name})

  • and you would observe the power of ui.router more, as you dive deeper into angular.

  • Trying to keep it simple, given you are an "angular noob" :-).


    I'd recommend starting with uiRouter, it can do (almost) everything that ngRouter can do and a lot more (eg nested routes, views etc.). I think the only thing that ngRouter has, but uiRouter doesn't is optional URL parameters.

    链接地址: http://www.djcxy.com/p/77968.html

    上一篇: 如何在Angular JS中的routeProvider中传递参数?

    下一篇: ui路由器vs ngroute for sinlge页面应用程序