Bird
0
0

Which decorator makes a class injectable in Angular?

easy📝 Syntax Q12 of 15
Angular - Services and Dependency Injection
Which decorator makes a class injectable in Angular?
A@Component
B@Input
C@NgModule
D@Injectable
Step-by-Step Solution
Solution:
  1. Step 1: Identify Angular decorators for injection

    The decorator @Injectable marks a class as available for dependency injection.
  2. Step 2: Eliminate other decorators

    @Component is for components, @NgModule for modules, and @Input for input properties, none make a class injectable.
  3. Final Answer:

    @Injectable -> Option D
  4. Quick Check:

    @Injectable = makes class injectable [OK]
Quick Trick: Use @Injectable to mark services for injection [OK]
Common Mistakes:
MISTAKES
  • Confusing @Component with @Injectable
  • Using @NgModule to make services injectable
  • Forgetting to add @Injectable to services

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes