Skip to content

Commit a704b08

Browse files
Jad31atscott
authored andcommitted
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)
1 parent 43a0e28 commit a704b08

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

adev/src/llms.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ Angular — Deliver web apps with confidence 🚀
6464
- [Setting up the HttpClient](https://angular.dev/guide/http/setup)
6565
- [Making requests](https://angular.dev/guide/http/making-requests)
6666
- [Intercepting requests](https://angular.dev/guide/http/interceptors)
67+
- [Reactive data fetching with httpResource](https://angular.dev/guide/http/http-resource)
6768
- [Testing](https://angular.dev/guide/http/testing)
6869

6970
## Forms
@@ -73,6 +74,10 @@ Angular — Deliver web apps with confidence 🚀
7374
- [Template driven forms](https://angular.dev/guide/forms/template-driven-forms)
7475
- [Validate forms input](https://angular.dev/guide/forms/form-validation)
7576
- [Building dynamic forms](https://angular.dev/guide/forms/dynamic-forms)
77+
- [Signal Forms](https://angular.dev/guide/forms/signals/overview)
78+
79+
## Accessibility
80+
- [Angular Aria overview](https://angular.dev/guide/aria/overview)
7681

7782
## Routing
7883
- [Routing overview](https://angular.dev/guide/routing)

packages/core/resources/best-practices.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ You are an expert in TypeScript, Angular, and scalable web application developme
1010

1111
- Always use standalone components over NgModules
1212
- 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+.
1314
- Use signals for state management
1415
- Implement lazy loading for feature routes
1516
- 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
2728
- Use `input()` and `output()` functions instead of decorators
2829
- Use `computed()` for derived state
2930
- 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
3133
- Do NOT use `ngClass`, use `class` bindings instead
3234
- Do NOT use `ngStyle`, use `style` bindings instead
3335
- 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
5052

5153
- Design services around a single responsibility
5254
- Use the `providedIn: 'root'` option for singleton services
55+
- Prefer the `@Service` decorator over `@Injectable({providedIn: 'root'})` for new singleton services (Angular v22+)
5356
- Use the `inject()` function instead of constructor injection

0 commit comments

Comments
 (0)