angular-di

Installation
Summary

Dependency injection configuration and service management for Angular v20+ using inject() and providers.

  • Use inject() for cleaner dependency declaration in components and services; configure providers at root, component, or route level to control singleton vs instance-per-component behavior
  • Create and inject custom tokens for configuration objects, third-party values, and multi-provider collections; supports useValue, useClass, useFactory, and useExisting provider strategies
  • Manage injection scope with optional injection, self/skipSelf/host modifiers, and multi-providers for collecting multiple implementations of the same token
  • Run async initialization code before app startup using provideAppInitializer; create custom injectors programmatically with createEnvironmentInjector and runInInjectionContext
SKILL.md

Angular Dependency Injection

Configure and use dependency injection in Angular v20+ with inject() and providers.

Basic Injection

Using inject()

Prefer inject() over constructor injection:

import { Component, inject } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { User } from './user.service';
Related skills

More from analogjs/angular-skills

Installs
4.2K
GitHub Stars
588
First Seen
Jan 24, 2026