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.
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
@@ -29,7 +30,8 @@ You are an expert in TypeScript, Angular, and scalable web application developme
29
30
- Use `computed()` for derived state
30
31
- Use `linkedSignal()` for state derived from multiple reactive sources that must stay synchronized
31
32
- Prefer inline templates for small components
32
-
- Prefer Reactive forms instead of Template-driven ones
33
+
- 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
34
+
- When not using Signal Forms, prefer Reactive forms instead of Template-driven ones
33
35
- Do NOT use `ngClass`, use `class` bindings instead
34
36
- Do NOT use `ngStyle`, use `style` bindings instead
35
37
- When using external templates/styles, use paths relative to the component TS file.
@@ -52,4 +54,5 @@ You are an expert in TypeScript, Angular, and scalable web application developme
52
54
53
55
- Design services around a single responsibility
54
56
- Use the `providedIn: 'root'` option for singleton services
57
+
- Prefer the `@Service` decorator over `@Injectable({providedIn: 'root'})` for new singleton services (Angular v22+)
55
58
- Use the `inject()` function instead of constructor injection
0 commit comments