-
Notifications
You must be signed in to change notification settings - Fork 171
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
AngularUI Router #9
Comments
If all you are looking for is to load controller using RequireJS syntax (i.e.: not on-demand loading), here is what you can do: On-demand loading should also be possible as ui-router also have a You should be able to do something like:
As I do not use ui-router, I am not sure if that actually works. If you setup a simple plunker with ui-router, I can try to wire angularAMD in. Here is a very simple angularAMD plunker as an example: |
Thank you for your reply! What I am hoping to accomplish is to load the AngularJS modules that contain all the JavaScript logic for the private part of the site (controllers, services, filters, directives, ...) when someone navigates to a child state under the "private" base/root state. The controllers, services, filters, directives, ... for the private/public part of the site will be split each in its own file and concatenated/minified into 1 file on build. Is this achievable usingAMD? Am I going the right way about how to achieve this? I created a plunker with ui-router as you requested: http://plnkr.co/edit/T7P9Dnd2dnJb2B9Czt13?p=preview |
Ok, here is the updated plunker with on-demand loading of your Following is the summary of steps I've taken:
Please note the following:
Finally, I am working a |
Actually, |
@marcoslin Thanks for your help and sorry for the late reply. I had a look at the sample site and I'm thinking to load the private controllers, directives etc. in the way it is shown with the dataservices.js and dataservicesAMD.js. But I don't know yet how to use grunt to change the requirejs configuration from development to production. In development the controllers, directives etc. should be loaded from separate files while in production they would be concatenated. I will do more research and post here when I find out how. |
Did the plunker I created not address your need? Can you give me some feedback on why it didn't and how you wish it could be improved? As per issue #8, I am replacing the need to create a *AMD.js to a RequireJS plugin
Check out updated module_ctrl.js As for using grunt to change RequireJS config, I have done that in the unit test for angularAMD, creating test for pre and post minification using mustache. It is not ideal but it works. If you do find something else, do keep me posted. |
The plunker you provided did address what I was asking for, only I was not expecting it to be done that way. About the gruntfile, possible I didn't look in the right place but I did not find a way to change the requirejs configuration. Could you provide a link to that file? |
AngularAMD works perfectly with ui-router for controllerUrl, but when used multiple views it is not functional. This functionality is documented here: https://github.com/angular-ui/ui-router/wiki/Multiple-Named-Views. I am thinking that you simply need to check for the "views" property, and interate through the object and check for the "controllerUrl" property and run the "route" function on that object. I haven't tried that yet, wanted input if that is the proper way of handling that, or if maybe I am mistaken and there is support for this. |
angularAMD rely on You can try to use
|
Of course, that makes perfect sense. I was just utilizing it on the entire state, but your suggestion is the obvious answer. Thank you! |
Hi, i'm trying to use ui-router multiple views in this way:
but it seems not to work... what i'm doing wrong? Thanks, |
Is it possible to use angularAMD with AngularUI Router? The routing in ui-router being done with
$stateProvider
and$urlRouterProvider
(for default route).The text was updated successfully, but these errors were encountered: