You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: add Signal Forms and v22 guidance to AI best-practices and llms.txt
Update the AI codegen resources for Angular v22:
- best-practices.md: OnPush is the default in v22+ (don't set it explicitly),
recommend Signal Forms, and recommend the @service decorator.
- llms.txt: add a Signal Forms reference, the httpResource guide, and an
Accessibility section linking the Angular Aria overview.
(cherry picked from commit 248e9c1)
Copy file name to clipboardExpand all lines: packages/core/resources/best-practices.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,7 @@ You are an expert in TypeScript, Angular, and scalable web application developme
10
10
11
11
- Always use standalone components over NgModules
12
12
- Must NOT set `standalone: true` inside Angular decorators. It's the default in Angular v20+.
13
+
- Do NOT set `changeDetection: ChangeDetectionStrategy.OnPush` explicitly. `OnPush` is the default in Angular v22+.
13
14
- Use signals for state management
14
15
- Implement lazy loading for feature routes
15
16
- Do NOT use the `@HostBinding` and `@HostListener` decorators. Put host bindings inside the `host` object of the `@Component` or `@Directive` decorator instead
@@ -27,7 +28,8 @@ You are an expert in TypeScript, Angular, and scalable web application developme
27
28
- Use `input()` and `output()` functions instead of decorators
28
29
- Use `computed()` for derived state
29
30
- Prefer inline templates for small components
30
-
- Prefer Reactive forms instead of Template-driven ones
31
+
- Prefer Signal Forms (`@angular/forms/signals`) for new forms. They are stable in Angular v22+ and provide signal-based state, type-safe field access, and schema-based validation
32
+
- When not using Signal Forms, prefer Reactive forms instead of Template-driven ones
31
33
- Do NOT use `ngClass`, use `class` bindings instead
32
34
- Do NOT use `ngStyle`, use `style` bindings instead
33
35
- When using external templates/styles, use paths relative to the component TS file.
@@ -50,4 +52,5 @@ You are an expert in TypeScript, Angular, and scalable web application developme
50
52
51
53
- Design services around a single responsibility
52
54
- Use the `providedIn: 'root'` option for singleton services
55
+
- Prefer the `@Service` decorator over `@Injectable({providedIn: 'root'})` for new singleton services (Angular v22+)
53
56
- Use the `inject()` function instead of constructor injection
0 commit comments