marcoslin / angularAMD

Facilitate use of RequireJS in AngularJS
http://marcoslin.github.io/angularAMD
MIT License
734 stars 171 forks source link

Detect angular modules without hardcoding "app.ngAMD.processQueue();" #8

Closed nissoh closed 11 years ago

nissoh commented 11 years ago

so. if i understand correctly. we will need to create a new r.js module with the deps and call app.ngAMD.processQueue();.

is there a way around this. like when registering a module on runtime. it will auto wire up .processQueue()?

marcoslin commented 11 years ago

Nissoh,

In short, not that I know of and would be happy to implement it if you have found a way.

The longer version: it would be possible to create an implementation to proxy the call of angular.module to app.register. However, this will only support those module that declare the dependencies in the correct order. As angular support out of order declaration, there is no easy method to check the module other than reading the source code. Hence my decision on implementing this using app.ngAMD.processQueue().

nissoh commented 11 years ago

how about require.js plugin as a replacement for the wrapper? wiring dependancies could be easy as ['ng!someModule']

http://requirejs.org/docs/plugins.html#intro

marcoslin commented 11 years ago

Interesting. I found a project that uses require.js plug-in: https://github.com/david-driscoll/ng-amd

I will try to add this as part of the next release. I hope to be able to work on this next week. If you have any working code, please share with me.