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.
Strongly recommended (9–10)¶
-
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 theDomSanitizer.bypassSecurityTrust*()methods, and don't write to the DOM throughElementRef.nativeElementordocument. (specific/angular) Automatable: Semgrepangular-bypasssecuritytrust. -
ANGULAR-14(9) Never put secrets, such as API keys, in the files insrc/environments/: the build bundles them into the client, where anyone who loads the page can read them. (specific/angular)
Recommended (6–8)¶
-
ANGULAR-16(8) Run a major version that is still supported, update withng updateone 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,OnPushchange detection and zoneless change detection. Don't setstandalone: false,ChangeDetectionStrategy.EagerorprovideZoneChangeDetection(). (specific/angular) Automatable: Angular extended diagnostics, angular-eslint. -
ANGULAR-2(7) Derive state withcomputed(), or withlinkedSignal()when the user can also set it, and useeffect()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, withasReadonly()orcomputed(), plus methods that change it. (specific/angular) -
ANGULAR-8(7) Lazy-load every route except the main landing pages withloadComponentorloadChildren, and wrap heavy components that aren't visible on the first render in@deferblocks. (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.Prerenderfor pages that are the same for every user,RenderMode.Serverfor pages with user-specific data, andRenderMode.Clientonly 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 thengCspNonceattribute or theCSP_NONCEtoken. On static hosting that can't add a nonce, turn onautoCspor 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'sstrict(TS-1), and make the extended diagnostics fail the build by setting theirdefaultCategorytoerror. (specific/angular) Automatable: Angular extended diagnostics. -
ANGULAR-3(6) Declare inputs, outputs and queries with the signal-based functions, such asinput(),output(),model()andviewChild(), and name outputs in camelCase, without anonprefix and without the name of a DOM event such asclick. (specific/angular) Automatable: angular-eslint. -
ANGULAR-4(6) Use the built-in control flow (@if,@forand@switch) instead of the deprecated*ngIf,*ngForand*ngSwitch, and give every@foratrackexpression 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 withinject(), and provide a service in a route'sprovidersinstead when only one feature uses it. (specific/angular) Automatable: angular-eslint. -
ANGULAR-7(6) Read data that depends on signals withhttpResource(), convert Observables that templates read withtoSignal(), and send changes, such asPOSTandPUTrequests, withHttpClientdirectly. (specific/angular) -
ANGULAR-10(6) Set thetitleproperty of every route, and move focus to the main content in a listener for the router'sNavigationEndevent. (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, awaitfixture.whenStable()instead of callingfixture.detectChanges(), and answer HTTP requests withHttpTestingController, then callverify(). (specific/angular)