CodeZettaInterview Hub

Angular · Dependency Injection · Junior · Concept

When do you use useClass, useValue, useFactory, and useExisting?

Short Interview Answer

They map a token to a class, literal, factory function, or alias of another token.

Detailed Explanation

Factories enable runtime config. useExisting aliases tokens. Prefer useClass for simple swaps in tests.

Did you know this answer?