Open dave-k opened 9 years ago
+1, have several large config files and would love the ability to load config outside of the app file.
Seems like this project is discontinued... Any thoughts about this issue @marcoslin ?
It seems like a lot at first to try doing what this plugin is doing, but it's not too bad if you take small steps and commit to the process.
I got frustrated with it because there always seemed to be JavaScript load errors when I tried using this library. I could never work out if it was me just doing it wrong (probably) or if it was something in the library that was not quite right.
So I ended up starting from with require-js and angular ui-router scratch with these ideas and came up with something usable, maybe it will help:
Basic demo: http://plnkr.co/edit/XU7MIXGAnU3kd6CITWE7?p=info More complete template: https://github.com/F1LT3R/angular-require-lazyload-template
Dan Wahlin's post is pretty helpful: http://weblogs.asp.net/dwahlin/dynamically-loading-controllers-and-views-with-angularjs-and-requirejs
Sorry guys... The day job is killing me and leaving me no time to address my side projects. The quick answer to the question is that yes, you can move the config to a config.js
file but the current implementation will only allow this to be done after bootstrap.
Take a look at the example here: https://plnkr.co/edit/G4pII6?p=preview
Basically, app.js
defines the home
state and page2
state is defined in config.js
which is only called when home_ctrl
is loaded.
I have an AngularAMD application as described here http://marcoslin.github.io/angularAMD/#/home
Can the app.config( ) { ... } section of code be moved from app.js into a config.js file? Where is the new config.js file loaded?
app.js