Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference in angularJS between ui.router and ui.state?

I am working on getting an angularJS SPA setup with multiple views using angular ui-router.

As I look aroun dthe web at tutorials and how-to's, I see a mixed bag of dependencies. The ui-router github page has examples that use ui.router as the module dependency, while other articles such as Ben Schwartz tutorial uses ui.state.

What is the difference? Is one deprecated? Is ui.state a subset of ui.router?

like image 316
tengen Avatar asked Nov 13 '13 21:11

tengen


1 Answers

In summary, ui.state was for v0.0.1, while ui.router is for v0.2.0 (the current version).

ui.state was the necessary module for users to inject as a dependency in v0.0.1 of ui-router. See the README at that release, as well as the relevant snippet from angular-ui-router.js (lines 45-48):

angular.module('ui.util', ['ng']);
angular.module('ui.router', ['ui.util']);
angular.module('ui.state', ['ui.router', 'ui.util']);
angular.module('ui.compat', ['ui.state']);

The README at v0.2.0 states under Quick Start: Set ui.router as a dependency in your module. Note: Use ui.state if using v0.0.1.

This is of course corroborated by angular-ui-router.js at v0.2.0, lines 79-83, showing the corresponding module dependency structure at that point:

angular.module('ui.router.util', ['ng']);
angular.module('ui.router.router', ['ui.router.util']);
angular.module('ui.router.state', ['ui.router.router', 'ui.router.util']);
angular.module('ui.router', ['ui.router.state']);
angular.module('ui.router.compat', ['ui.router']);
like image 136
Sarah Avatar answered Sep 29 '22 07:09

Sarah