-
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
Changes made to one controller be accessible through more than one route. #147
base: master
Are you sure you want to change the base?
Conversation
The build failed in these two lines of the utestProvider.js file: But i don't understand exactly why... Thanks. |
The error is due to animation. Could it be that bower.json somehow resolving to Angular 1.4.x? Per #138, angularAMD is having trouble with animation changes in Angular 1.4.x. |
bower.json is resolving "angular": "^1.3.0", Since this is a separate bug i just commented out these two lines of tests for the build to pass, so if you want you can uncomment them freely. I don't know if you got a chance to see my changes but they let you load more than one file per page. What do i mean is, if you have a page with its controller, and this page has its own filter/directives/services in separate files, you can load them as well. Look forward to hear from you. |
I just checked your code and you basically changed With
As result, the code will only resolve the first controller in the array. Is that intentional? If it is, might be worth putting some comment as of why this is ok. |
Is the following question in SO the reason for this change? |
Actually no, this question in SO is not the reason for the change. Yes, the code will resolve only the first controller in the array. I'll try to explain better. Lets supose that we have a specific feature, for example:
The code without my changes we evaluate that just fine. But what if the .js file for the controller is not the only file i want to load for this specific page? What if i want to load a filter or a service that are in separate files (registration-filters.js / registration-services.js) but i want to load them together with the controller? That's why the array, to evaluate all the files that i need, and not only the controller. Was i a little bit more clear now? If you got any questions or didn't understand feel free to ask/comment :) |
That is a lot clearer, thanks. I deal with the problem you described by setting the needed dependencies in the |
In the project we have here we use it like this: $routeProvider.when('/myModule/mySubmodule/myFeature2', angularAMD.route({ In the controllerUrl we pass the array of files that we want to load for that specific page/controller. And the getFileVersion function is to translate the url of the .js file (get the current path and name of the file) for production because they are renamed to a hash key to prevent cache. If you got any questions feel free to ask. |
Also lets you load more than one script (directive, filter, controller, services, etc) per route, in case these are in separate files and/or folders.