Writing modular code with ES2015
Another problem that JavaScript professionals have experienced over the years is the lack of a module system in the language. Initially, the community developed different patterns, aiming to enforce the modularity and the encapsulation of the software we produce. Such patterns included the module pattern, which takes advantage of the functional lexical scope and closures. Another example is the namespace pattern, which represents the different namespaces as nested objects. AngularJS introduced its own module system that unfortunately doesn't provide features, such as lazy module loading. However, these patterns were more like workarounds rather than real solutions.
CommonJS (used in node.js) and AMD (Asynchronous ...
Get Getting Started with Angular - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.