Closed matjaz closed 10 years ago
@matjaz thanks but I cannot merge this pull request as it represent breaking change for existing user. We should keep app.register
for backward compatibility.
About your comment: "Lazy loaded code should be the same as sync or async loaded", I was thinking to implement it in a way that extend that statement to support registering modules before bootstrap. Essentially, the way going forward is to do:
angularAMD.controller(...)
This way, angularAMD
would cache the requests and apply to provider when .bootstrap
is called.
Feedback?
ok. you can add app.register as an alias for /bc.
My point of view is angularAMD
should be used only for angularAMD.route()
. Other code should not rely on it and it should work without it. Only with requirejs or as a plain standalone angular module.
@matijaz I need to give this some more thoughts. I was planning to do exactly the opposite of your suggestion, i.e., to increase the use angularAMD
through out the project.
In my own projects, I often have library that initially only used by few modules and then it's use is extended. In this case, I would ideally wanna move this module to load as a dependency to app
instead of individual modules. The only way to accomplish this move transparently is to do something like angularAMD.service(...)
.
Having said that, my suggestion can be easily done in conjunction to your proposal. I just need to digest such change and see if it create more confusion for normal users.
It's just a bad week for me unfortunately.
No need separating registering lazy loaded controllers/services/...
Lazy loaded code should be the same as sync or async loaded. Controllers, services, filters,... should run without angularAMD.
Based on: https://github.com/matjaz/ng-1.x-async-hack