Say I've got state1
which has children state1.child1
and state2.child2
. There's also state2
which has state2.child1
and state2.child2
. Is there any way I can put a ui-view
in state1.child1
to view state2.child1
?
Asked
Active
Viewed 46 times
1

Radim Köhler
- 122,561
- 47
- 239
- 335

Alex Kibler
- 4,674
- 9
- 44
- 74
1 Answers
1
The answer is no (as most likely expected).
States are hierarchical, and the same applies to their views. So, we cannot display child of one hierarchy in another's hierarchy parent.
In case, we just wanted to reduce amount of code (declaring same views and substates in different hierarchies) we can use e.g. some decorators:

Community
- 1
- 1

Radim Köhler
- 122,561
- 47
- 239
- 335
-
Yeah, that's kind of what I expected. I've got a view/state that I wanted to be able to reuse in three-ish different places, but maybe it would make more sense to remake it as a directive instead. Although your solutions look good too. Thanks! – Alex Kibler Oct 22 '15 at 18:38
-
Great if that could help anyhow ;) Enjoy mighty UI-Router – Radim Köhler Oct 22 '15 at 18:54
-
Thanks! I have been for a few months. I've only been using Angular in general since July, but I'm loving it. – Alex Kibler Oct 22 '15 at 19:02