Skip to content

Angular checklist

Copy this list into a pull request, design review or project kickoff and tick what applies. Rules are grouped by level and sorted by score (criteria). Each links to the file that explains it and cites its sources. Automatable names tools that can check the rule in CI (see the file's "How to enforce" section).

Also apply the general checklist.

This file is generated by python3 scripts/rank.py fix from the guidelines. Don't edit it by hand.

  • ANGULAR-11 (9) Never use route guards as access control: check authorization on the server for every request. (specific/angular)
  • ANGULAR-12 (9) Never build Angular templates from user input: ship only templates that the CLI compiles ahead of time, and don't generate Angular templates with a server-side templating language. (specific/angular)
  • ANGULAR-13 (9) Insert untrusted values through template bindings, so that Angular sanitizes them, never pass them to the DomSanitizer.bypassSecurityTrust*() methods, and don't write to the DOM through ElementRef.nativeElement or document. (specific/angular) Automatable: Semgrep angular-bypasssecuritytrust.
  • ANGULAR-14 (9) Never put secrets, such as API keys, in the files in src/environments/: the build bundles them into the client, where anyone who loads the page can read them. (specific/angular)
  • ANGULAR-16 (8) Run a major version that is still supported, update with ng update one major version at a time, and plan each yearly major update before your version's long-term support ends. (specific/angular)
  • ANGULAR-1 (7) Keep the current defaults in new code: standalone components, OnPush change detection and zoneless change detection. Don't set standalone: false, ChangeDetectionStrategy.Eager or provideZoneChangeDetection(). (specific/angular) Automatable: Angular extended diagnostics, angular-eslint.
  • ANGULAR-2 (7) Derive state with computed(), or with linkedSignal() when the user can also set it, and use effect() only to sync signals with APIs that aren't reactive, such as storage, logging, or a canvas or third-party UI library. (specific/angular)
  • ANGULAR-5 (7) Keep components focused on presentation, and move business logic, data access and state that several components share into services. Keep that state in private writable signals, and expose it as read-only signals, with asReadonly() or computed(), plus methods that change it. (specific/angular)
  • ANGULAR-8 (7) Lazy-load every route except the main landing pages with loadComponent or loadChildren, and wrap heavy components that aren't visible on the first render in @defer blocks. (specific/angular) Automatable: Angular CLI size budgets.
  • ANGULAR-9 (7) In server-rendered apps, set a render mode for each route in the server routes: RenderMode.Prerender for pages that are the same for every user, RenderMode.Server for pages with user-specific data, and RenderMode.Client only where load performance and SEO matter less. (specific/angular)
  • ANGULAR-15 (7) Send a Content Security Policy with a unique, unpredictable nonce for each response, and pass the nonce to Angular with the ngCspNonce attribute or the CSP_NONCE token. On static hosting that can't add a nonce, turn on autoCsp or avoid inline scripts, instead of hard-coding a nonce. (specific/angular)
  • ANGULAR-17 (7) Keep strict template type checking on (strictTemplates, the default) together with TypeScript's strict (TS-1), and make the extended diagnostics fail the build by setting their defaultCategory to error. (specific/angular) Automatable: Angular extended diagnostics.
  • ANGULAR-3 (6) Declare inputs, outputs and queries with the signal-based functions, such as input(), output(), model() and viewChild(), and name outputs in camelCase, without an on prefix and without the name of a DOM event such as click. (specific/angular) Automatable: angular-eslint.
  • ANGULAR-4 (6) Use the built-in control flow (@if, @for and @switch) instead of the deprecated *ngIf, *ngFor and *ngSwitch, and give every @for a track expression with a property that uniquely identifies the item, such as its ID. (specific/angular) Automatable: angular-eslint.
  • ANGULAR-6 (6) Declare app-wide services with @Service(), or with @Injectable({providedIn: 'root'}) before Angular 22, inject dependencies with inject(), and provide a service in a route's providers instead when only one feature uses it. (specific/angular) Automatable: angular-eslint.
  • ANGULAR-7 (6) Read data that depends on signals with httpResource(), convert Observables that templates read with toSignal(), and send changes, such as POST and PUT requests, with HttpClient directly. (specific/angular)
  • ANGULAR-10 (6) Set the title property of every route, and move focus to the main content in a listener for the router's NavigationEnd event. (specific/angular)
  • ANGULAR-18 (6) Test components the way users use them, and let Angular schedule change detection: drive shared UI components through component harnesses, await fixture.whenStable() instead of calling fixture.detectChanges(), and answer HTTP requests with HttpTestingController, then call verify(). (specific/angular)