1

In a mini test that I made there were 4 (true/false) questions about UI Router VS ngRoute. I did the test and my research, but I am not sure about my answers. Can someone please confirm and help me justify?

The questions:

  1. Angular UI Router allows you to save state when switching tabs, ngRoute does not
  2. They both use URLs to uniquely identify views
  3. They both associate a template and a controller with a view
  4. They both use the same service for route parameters

My answers:

  1. True
  2. True
  3. False
  4. True

My justifications:

  1. Following from the question " What is the difference between angular-route and angular-ui-router? " I am fairly sure that option 1 is true.
  2. Now this one I am not sure. I know that you can use UI Route to create dynamic URLs, but that is as far as my knowledge goes.
  3. This one I believe is false. In an Angular UI template one can have several views, in fact a common example is with pages that have a top section, a middle section and a common bottom section. If this implication however means that the affirmation is incorrect, I am not sure, but I am led to believe it.
  4. Given that Angular UI is an extension of ngRoute, I believe that 4 is also true.
4
  • 1st - false as stackoverflow.com/questions/16872191/… and example plnkr.co/edit/fuVb0mzhmDCKr1xKp7Rn?p=preview and 5th - ui-router supports nested views - this is source of its power Commented Mar 30, 2016 at 15:40
  • I fail to see how nested views answer any of my questions, and 1st is true, your link seems to miss the heart of the question. Commented Mar 30, 2016 at 16:12
  • Link doesn't exist. 404 Commented Mar 30, 2016 at 18:19
  • I think 2 is false.UI Router uses state instead of url's.i am not positive open to correction. Commented Mar 31, 2016 at 14:51

1 Answer 1

4

After some sound advice, I finally got it! Here are my answers and justifications.

Answers:

  1. True
  2. True
  3. True
  4. False

Justifications:

  1. Following from the question " AngularJS : Difference between angular-route and angular-ui-router " one can see that states can be used to keep a history stack. (Keep states in mind, it will be useful later on).
  2. Even though Angular UI can have nested views, those views can still be accessible by specific and unique URLs.
  3. Even though a template can have several views, nothing prevents the relation of 1-1-1 with a controller-template-view. It is possible.
  4. And here, states come in handy. Angular UI uses a state service, while ngRoute does not. The focus of the question was on this, but I was not getting it.

There you go, hope it helps other people !

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.