MCPcopy
hub / github.com/angular/angular / NgModule

Interface NgModule

packages/core/src/metadata/ng_module.ts:33–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31 * @publicApi
32 */
33export interface NgModule {
34 /**
35 * The set of injectable objects that are available in the injector
36 * of this module.
37 *
38 * @see [Dependency Injection guide](guide/di/dependency-injection)
39 * @see [NgModule guide](guide/ngmodules/providers)
40 *
41 * @usageNotes
42 *
43 * Dependencies whose providers are listed here become available for injection
44 * into any component, directive, pipe or service that is a child of this injector.
45 * The NgModule used for bootstrapping uses the root injector, and can provide dependencies
46 * to any part of the app.
47 *
48 * A lazy-loaded module has its own injector, typically a child of the app root injector.
49 * Lazy-loaded services are scoped to the lazy-loaded module's injector.
50 * If a lazy-loaded module also provides the `UserService`, any component created
51 * within that module's context (such as by router navigation) gets the local instance
52 * of the service, not the instance in the root injector.
53 * Components in external modules continue to receive the instance provided by their injectors.
54 *
55 * ### Example
56 *
57 * The following example defines a class that is injected in
58 * the HelloWorld NgModule:
59 *
60 * ```ts
61 * class Greeter {
62 * greet(name:string) {
63 * return 'Hello ' + name + '!';
64 * }
65 * }
66 *
67 * @NgModule({
68 * providers: [
69 * Greeter
70 * ]
71 * })
72 * class HelloWorld {
73 * greeter:Greeter;
74 *
75 * constructor(greeter:Greeter) {
76 * this.greeter = greeter;
77 * }
78 * }
79 * ```
80 */
81 providers?: Array<Provider | EnvironmentProviders>;
82
83 /**
84 * The set of components, directives, and pipes (declarables
85 * that belong to this module.
86 *
87 * @usageNotes
88 *
89 * The set of selectors that are available to a template include those declared here, and
90 * those that are exported from imported NgModules.

Callers 15

SomeLibModuleClass · 0.90
SomeModuleClass · 0.90
MyModuleClass · 0.90
TestModuleClass · 0.90
ErrorModuleClass · 0.90
SomeModuleClass · 0.90
CustomModuleClass · 0.90
AsyncModuleClass · 0.90
TestModuleAClass · 0.90
AmbientModuleClass · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…