user5325276
user5325276

Reputation:

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.

Upvotes: 5

Views: 3065

Answers (2)

Nishant
Nishant

Reputation: 5079

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" :-).

Upvotes: 3

Kristiyan Kostadinov
Kristiyan Kostadinov

Reputation: 3712

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

Upvotes: 1

Related Questions