-
Notifications
You must be signed in to change notification settings - Fork 3k
Opinions: Organizing large $stateProviders #1051
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
This is more of a question for stack overflow I'd say. I'd urge you to look at the 'Multiple Named Views' section of my presentation talking about antipatterns though. I think you may be running into one. Additionally its quite common to split your states across modules. Look at the ng-boilerplate (https://github.com/ngbp/ngbp) project (which might actually answer your question wholly). It's quite complex but SO worth grokking. |
Thanks @timkindberg, the ng-boilterplate definitely helped! |
My proposal is based on ES6 modules.
import controller from './edit.controller';
import template from './edit.state.html';
// State name is exported so we can use it in the corresponding tests
export const name = 'contacts.one.edit';
export default {
name,
url: '/edit',
template,
controller,
controllerAs: 'ctrl'
}; This configuration could be activated in the module's configuration block with Here you could find the complete example https://github.com/lucassus/angular-webpack-seed/tree/ce4e9b91ce9ed47ca74073d754b0cbacff8cb65f/src/app/contacts/one/edit |
Would like to get some insight into how others are organizing their medium to large sized application states.
For our app we're using named states to seperate out the defined sections, as such:
This leads to something like this for our
$stateProvider
config:This starts to get unwieldy when you have anymore than a few states with large resolves in each one. What are some strategies folks are using to keep things more organized? I've thought about creating separate modules for each state and child states - is that realistic?
The text was updated successfully, but these errors were encountered: