Angularjs routeprovider vs stateprovider

What is the difference between angularjs $routeprovider and angularjs $stateprovider. I’ve seen both used and wondered which one to choose?

ie stateProvider

ie routeprovider

We started with $routeProvider and moved to $stateProvider to leverage some of the features that ui-router provides.

Warning: UI-Router is pre-beta and under active development. As such, while this library is well-tested, the API is subject to change. Using it in a project that requires guaranteed stability is not recommended.

Differences?

* routeprovider is the default Angular router used with ngRoute
* stateProvider is used by ui-router which provides a different implementation of routeprovider

refs:

  • http://phillippuleo.com/articles/angularjs-timing-multiple-resource-resolves-ngroute-and-ui-router
  • http://stackoverflow.com/questions/19388852/to-routeprovider-or-stateprovider
  • http://joelhooks.com/blog/2013/07/22/the-basics-of-using-ui-router-with-angularjs/
Sam is a passionate web developer, online entrepreneur and investor. In his spare time he enjoys coding, playing chess and reading.

Leave a Reply

Your email address will not be published. Required fields are marked *