MCPcopy Index your code
hub / github.com/angular/angular / constructor

Method constructor

packages/core/src/di/injection_token.ts:96–117  ·  view source on GitHub ↗
(
    protected _desc: string,
    options?: {
      providedIn?: Type<any> | 'root' | 'platform' | 'any' | null;
      factory: () => T;
    },
  )

Source from the content-addressed store, hash-verified

94 );
95
96 constructor(
97 protected _desc: string,
98 options?: {
99 providedIn?: Type<any> | 'root' | 'platform' | 'any' | null;
100 factory: () => T;
101 },
102 ) {
103 this.ɵprov = undefined;
104 if (typeof options == 'number') {
105 (typeof ngDevMode === 'undefined' || ngDevMode) &&
106 assertLessThan(options, 0, 'Only negative numbers are supported here');
107 // This is a special hack to assign __NG_ELEMENT_ID__ to this instance.
108 // See `InjectorMarkers`
109 (this as any).__NG_ELEMENT_ID__ = options;
110 } else if (options !== undefined) {
111 this.ɵprov = ɵɵdefineInjectable({
112 token: this,
113 providedIn: options.providedIn || 'root',
114 factory: options.factory,
115 });
116 }
117 }
118
119 /**
120 * @internal

Callers

nothing calls this directly

Calls 2

assertLessThanFunction · 0.90
ɵɵdefineInjectableFunction · 0.90

Tested by

no test coverage detected