We're starting a project with NG2 using Typescript The architect is not a fan of having to do imports by referencing files by `path/name` (the ES6 way or otherwise) and would rather reference modules by namespace/name
Before Typescript starts implementing ES6-style modules, when you are targeting ES5 from TS, it basically creates namespaces with closures. Since NG1 doesn't natively support lazyloading of (angular) modules it's not really a problem since the app is to be bundled anyways. With NG2 (correct me if I'm wrong) supporting lazy loading, and I feel using ES6 modules would be the way to go; It's a long shot, but would there be a way to still reference modules by name instead of filename? What would be the pros/cons you'd see? Assuming it's not, and he decides that we should not use Es6 modules and stay with TS internal modules (now called namespace I think?), how bad a choice would it be and why? Would it still be possible to achieve lazy loading of module if the need arise? If he/we decide to go the ES6-style module route; I suppose we absolutely need some kind of module loader such as System/JSPM or Webpack or even Browserify, am I right? Any other option out there? (I'm asking about strategies, not tools such as requireJS) And last question, which is closer to lazy loading with NG2: Would it be possible to load a module conditionally based on, say, a user's role? Say the user only has access to the application's A, B, D sections, only load those modules that defines these sections, and not C which the user don't have access to, saving on bandwidth and what not I realize there are more than one question here but since they are intimately related, I figured I'd make a single post about it Thank you! O. -- 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 https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
