Whoops! I buried the lead -- perhaps due to the fact that I made the 
mistake of boarding a San Francisco bus in the middle of pride weekend and 
the world cup and began to go a bit stir crazy.

Anyway, you can use RequireJS oretty effectively using a combination of 
it's ways to enable namespeces through aliases and its relative path 
support, e.g. something like

require.config({
 baseDir: 'someDir',

 paths: {
  'some.namespace': '../path-to-dir/sub-dir'
  }
);

and then have anonymous define funcs like:

define(['some.namespace/my-modylule'], function(myMod) {
 // illustrates a namespaced module
 return theMod;
});

and

define(['./some-subdir-of-this-dir/xyz', function(xyz) {
 // illustrates a module located in the sudir of wherever this code appears
  return theXyzThing;
});

It's not quite like namespaces in other languages, but ultimately you can 
get the job done.

As to my comment about Angular 2.0, I think the key to realize while you're 
building something that you want to go live in the near future is that you 
*could* at least writing ES6 modules with Angular 1.x as an alternative 
that will work for now, and one that would allow you to at least begin to 
use the future module method that we'll pretty much all use eventually... 
and with traceur you'd be compiling back through requirejs on the way out 
the door.

By the way, a compile step to boil off the requirejs for a prod site if 
fine, but antithetical to lazy loading, which if you really have a gigantic 
app, might behoove you.

Sorry to answer in two parts, blame the nutjobs on Van Ness Ave. and my 
ultimate inability to cope. :)


On Saturday, June 28, 2014 8:23:02 PM UTC-7, Daphne Maddox wrote:
>
> requirejs supports relative paths.
>
> Used properly it scales cleanly and is a lifeasaver.
>
> There are a number of modules out there to lazy load angular components 
> using requirejs. I would definitely recommend such an architecture for your 
> situation if you dont want to load a giant app up front.
>
> Also, it might be worth it to know that were you to play around with 
> Angular 2.0 today, you'd see that its es6 modules compile down to 
> requirejs/amd syntax since that's how traceur compiler, converts es6 to es5 
> for the browser. Just sayin.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to