11

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?

1 Answer 1

25

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']);
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you Sarah, that certainly clears it up for me. I appreciate you taking the time to help me out!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.