mcpField
A
angular-standalone

angular-standalone

github.com/oguzhan18Development7189 installsUpdated 31w ago
Repository

About angular-standalone

A development skill for building Angular applications with standalone components. It covers component imports, application bootstrapping, functional providers, routing, lazy loading, and migration from NgModule.

Key features

  1. 01Create standalone components
  2. 02Declare dependencies in the imports array
  3. 03Bootstrap with bootstrapApplication
  4. 04Configure functional providers and routing
  5. 05Lazy-load standalone components
  6. 06Migrate from NgModule

Use cases

  1. 01Build an Angular app without NgModule-based components
  2. 02Configure routing for a standalone application
  3. 03Load feature components on demand
  4. 04Convert existing components with the migration schematic

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/oguzhan18/angular-ecosystem-skills --skill angular-standalone

After installing, type/angular-standalonein Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/discussions/
_INDEX.md
references/docs/
_INDEX.md
references/issues/
_INDEX.md
references/releases/
_INDEX.md

Details

From the project README

Angular Standalone Components

Version: Angular 21 (2025) Tags: Standalone, Components, Imports, Bootstrap

References: Standalone Guide • Migration

API Changes

This section documents recent version-specific API changes.

  • NEW: Standalone by default — New components are standalone by default since Angular 17

  • NEW: provideRouter for standalone — Use functional providers instead of RouterModule

  • NEW: ng generate @angular/core:standalone — Migration schematic

  • DEPRECATED: NgModule — Migration to standalone components recommended

Best Practices

  • Create standalone components
@Component({
  standalone: true,
  imports: [CommonModule, MatButtonModule],
  selector: 'app-my',
  template: `<button>Click</button>`
})
export class MyComponent {}
  • Use imports array for dependencies
@Component({
  standalone: true,
  imports: [
    CommonModule,
    RouterModule,
    MatCardModule,
    MyChildComponent
  ],
  template: `
    <mat-card>
      <app-my-child></app-my-child>
    </mat-card>
  `
})
export class ParentComponent {}
  • Bootstrap standalone component
// main.ts
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';
import { appConfig } from './app/app.config';

bootstrapApplication(AppComponent, appConfig)
  .catch(err => console.error(err));
  • Use functional providers
export const appConfig: ApplicationConfig = {
  providers: [
    provideRouter(routes),
    provideHttpClient(),
    provideAnimations()
  ]
};
  • Use provideZoneChangeDetection
export const appConfig: ApplicationConfig = {
  providers: [
    provideZoneChangeDetection({ eventCoalescing: true })
  ]
};
  • Migrate from NgModule
# Full migration
ng generate @angular/core:standalone

# Specific component
ng generate @angular/core:standalone --path=path/to/component
  • Use Router Outlet with standalone
@Component({
  standalone: true,
  imports: [RouterOutlet],
  template: `<router-outlet></router-outlet>`
})
export class AppComponent {}
  • Lazy load standalone components
const routes: Routes = [
  {
    path: 'admin',
    loadComponent: () => import('./admin/admin.component').then(m => m.AdminComponent)
  }
];
  • Use forwardRef for circular imports
@Component({
  standalone: true,
  imports: [forwardRef(() => OtherComponent)]
})
export class MyComponent {}
  • Export standalone components
@Component({
  standalone: true,
  exports: [MyComponent],
  imports: [MyComponent]
})
export class FeatureComponent {}

Comments

Markdown supported