javascriptangularjsangularjs-routingangular-ui-routerangularjs-module

What is the difference between angular-route and angular-ui-router?


I'm planning to use AngularJS in my big applications. I'm in the process to find out the right modules to use.

What is the difference between ngRoute (angular-route.js) and ui-router (angular-ui-router.js) modules?

In many articles when ngRoute is used, routes are configured with $routeProvider. However, when used with ui-router, routes are configured with $stateProvider and $urlRouterProvider.

Which module should I use for better manageability and extensibility?


Solution

  • ui-router is a 3rd-party module and is very powerful. It supports everything the normal ngRoute can do as well as many extra functions.

    Here are some common reason ui-router is chosen over ngRoute:

    In essence, ui-router is ngRouter with more features, under the sheets it is quite different. These additional features are very useful for larger applications.

    More Information: