Last hours I have been reading through docs of UI-Router. But I can't find a solution for my problem.
My webapp has two different columns, a list on the left and a detail view on the right. Selecting a element of the list should show detail information on the right.
Which of this two approaches described in the title would you prefer? When to use what?
In fact, the List x Detail scenario is the most suitable for
ui-router
. These are in fact two states, the parent/child (i.e. child states to answer the question):List view
(e.g. the left column). This could be a dynamic view, with paging, sorting and filtering, but still - this will always be a gateway, a parent to:Detail view
(e.g. the right column). To select a detail (unless navigating via url directly) we simply need aList view
. To select different detail, we can profit from a fact, that the parent/List view
state is not reloading, while iterating among many details...The best we can do is to observe the example, provided by
ui-router
team:And we can also see its definition, which is part of this states definition:
this link, belongs to the best documented pieces of code I do remember... It explains everything and also helps to learn how the
ui-router
state definition is working.Below I tried to show that power by citing the definition of the List and Detail states.
The List state:
the Detail state:
Summary: In these scenarios, do use the parent/child state definition, because the parent will be loaded only once, and keep its data, while we are iterating among its children
Check these links for some more details: