You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
AMD declares how to load modules. Modules are functions declared within a call to a define function. Multiple define statements can occur within one script. Where scripts are loaded is not defined by the AMD specification. Indeed the AMD compliant almond.js loader [1] does not manage the loading of files at all, but requires them to have been loaded prior to the require function being invoked.
Description
As a newcomer to Angular.js I find the distinction between AMD modules and Angular modules highly confusing. To that end, and to serve the distinction made elsewhere [2], would deprecating the use of the "module" name and using "component" be more appropriate? In Spring parlance, a component can be auto-wired (injected) and can receive an @PostConstruct annotated method. This is similar to your config and run functions respectively.
A module in AMD terms can contain a collection of components. Perhaps it is useful to think of modules and components being akin to Java's packages and injectable classes respectively.
@huntc Unfortunately module, component and package are one of those overloaded words in IT that can mean different things to different people depending on their background etc.
Having said the above AngularJS modules are not at all as Spring components (beans!). If you would have to find an analogy from the Spring world, AngularJS modules would be closer to Spring's containers (although lifecycle is completely different). Spring components / beans are (roughly) equivalent of AngularJS providers (services, factories etc.).
Going to close this one for now as renaming current module to component would create even more confusion IMO. As things stand today AngularJS modules are collections of providers that produce objects instances (services etc.) during runtime. Hope this clarifies things a bit for you.
Definition of an AMD module
AMD declares how to load modules. Modules are functions declared within a call to a define function. Multiple define statements can occur within one script. Where scripts are loaded is not defined by the AMD specification. Indeed the AMD compliant almond.js loader [1] does not manage the loading of files at all, but requires them to have been loaded prior to the require function being invoked.
Description
As a newcomer to Angular.js I find the distinction between AMD modules and Angular modules highly confusing. To that end, and to serve the distinction made elsewhere [2], would deprecating the use of the "module" name and using "component" be more appropriate? In Spring parlance, a component can be auto-wired (injected) and can receive an @PostConstruct annotated method. This is similar to your config and run functions respectively.
A module in AMD terms can contain a collection of components. Perhaps it is useful to think of modules and components being akin to Java's packages and injectable classes respectively.
[1] https://github.com/jrburke/almond
[2] #1382
The text was updated successfully, but these errors were encountered: