-
Notifications
You must be signed in to change notification settings - Fork 3k
Support 'children' property on stateConfig #346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It's a decent idea. Not urgent though. |
If anything I think we would implement this as a getter method. |
Is this a good example of something that could be added via the decorator? |
Not really, because when defining a parent, the child states wouldn't have been added yet. I just don't think it makes sense. Also, for this:
You really only ever use (1) & (3), and which one you use is going to be pre-determined for you based on whether you use string or object states. |
I have created a simple module with my helper function, ui-router.stateHelper. With this helper you can easily define nested states by using |
@marklagendijk I added your helper to our guide as a recommended way to build state trees. Thanks for the contribution! |
Currently there are 3 ways of defining states:
name: 'contacts.list'
parent: 'contacts'
parent: contacts
(where 'contacts' is an stateObject)To me it would make sense to also support a 'children' property. This would be used as follows:
In the end it is all a matter of preference. I don't think it matters a lot which ways are supported. Currently I use the following function to support the method described above.
What would be more useful is the fact that you would have the children property available afterwards. This way a state would know which children it has. Which would allow for things like:
The text was updated successfully, but these errors were encountered: