@@ -242,20 +242,20 @@ The `useFactory` syntax allows for creating providers **dynamically**. The actua
242242@@filename ()
243243const connectionProvider = {
244244 provide: ' CONNECTION' ,
245- useFactory : (optionsProvider : OptionsProvider , optionalProvider ? : string ) => {
245+ useFactory : (optionsProvider : MyOptionsProvider , optionalProvider ? : string ) => {
246246 const options = optionsProvider .get ();
247247 return new DatabaseConnection (options );
248248 },
249- inject: [OptionsProvider , { token: ' SomeOptionalProvider' , optional: true }],
250- // \_____________/ \__________________/
251- // This provider The provider with this
252- // is mandatory. token can resolve to `undefined`.
249+ inject: [MyOptionsProvider , { token: ' SomeOptionalProvider' , optional: true }],
250+ // \______________/ \__________________/
251+ // This provider The provider with this token
252+ // is mandatory. can resolve to `undefined`.
253253};
254254
255255@Module ({
256256 providers: [
257257 connectionProvider ,
258- OptionsProvider ,
258+ MyOptionsProvider , // class-based provider
259259 // { provide: 'SomeOptionalProvider', useValue: 'anything' },
260260 ],
261261})
@@ -267,16 +267,16 @@ const connectionProvider = {
267267 const options = optionsProvider .get ();
268268 return new DatabaseConnection (options );
269269 },
270- inject: [OptionsProvider , { token: ' SomeOptionalProvider' , optional: true }],
271- // \_____________ / \__________________/
272- // This provider The provider with this
273- // is mandatory. token can resolve to `undefined`.
270+ inject: [MyOptionsProvider , { token: ' SomeOptionalProvider' , optional: true }],
271+ // \______________ / \__________________/
272+ // This provider The provider with this token
273+ // is mandatory. can resolve to `undefined`.
274274};
275275
276276@Module ({
277277 providers: [
278278 connectionProvider ,
279- OptionsProvider ,
279+ MyOptionsProvider , // class-base provider
280280 // { provide: 'SomeOptionalProvider', useValue: 'anything' },
281281 ],
282282})
0 commit comments