Skip to content

Commit 46a9e7d

Browse files
committed
fixup! feat(@angular/cli): add initial set of signal form examples
1 parent 4b8968a commit 46a9e7d

17 files changed

+39
-37
lines changed

packages/angular/cli/lib/examples/signal-forms/01-basic-signal-form.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export class UserProfileComponent {
7979
The template is wrapped in a `<form>` tag with a `(submit)` event and a submit button.
8080

8181
```html
82-
<form (submit)="handleSubmit(); $event.preventDefault()">
82+
<form (submit)="handleSubmit(); $event.preventDefault()" novalidate>
8383
<div>
8484
<label>
8585
First Name:

packages/angular/cli/lib/examples/signal-forms/02-built-in-validators.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export class UserSettingsComponent {
102102
This file provides the template for the form, displaying specific error messages for each potential validation failure.
103103

104104
```html
105-
<form (submit)="handleSubmit(); $event.preventDefault()">
105+
<form (submit)="handleSubmit(); $event.preventDefault()" novalidate>
106106
<div>
107107
<label>Username:</label>
108108
<input type="text" [control]="settingsForm.username" />
@@ -165,7 +165,7 @@ This file provides the template for the form, displaying specific error messages
165165
}
166166
</div>
167167

168-
<button type="submit" [disabled]="!settingsForm().valid()">Save Settings</button>
168+
<button type="submit">Save Settings</button>
169169
</form>
170170
```
171171

packages/angular/cli/lib/examples/signal-forms/03-cross-field-validation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export class PasswordFormComponent {
103103
This file provides the template for the form, showing how to display errors for both field-level and cross-field validation rules.
104104

105105
```html
106-
<form (submit)="handleSubmit(); $event.preventDefault()">
106+
<form (submit)="handleSubmit(); $event.preventDefault()" novalidate>
107107
<div>
108108
<label>
109109
Password:
@@ -135,7 +135,7 @@ This file provides the template for the form, showing how to display errors for
135135
}
136136
</div>
137137

138-
<button type="submit" [disabled]="!passwordForm().valid()">Submit</button>
138+
<button type="submit">Submit</button>
139139
</form>
140140
```
141141

packages/angular/cli/lib/examples/signal-forms/04-conditional-validation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export class ContactFormComponent {
8585
This file provides the template for the form, which includes a checkbox that controls the validation of another field.
8686

8787
```html
88-
<form (submit)="handleSubmit(); $event.preventDefault()">
88+
<form (submit)="handleSubmit(); $event.preventDefault()" novalidate>
8989
<div>
9090
<label>
9191
<input type="checkbox" [control]="contactForm.subscribe" />
@@ -105,7 +105,7 @@ This file provides the template for the form, which includes a checkbox that con
105105
}
106106
</div>
107107

108-
<button type="submit" [disabled]="!contactForm().valid()">Submit</button>
108+
<button type="submit">Submit</button>
109109
</form>
110110
```
111111

packages/angular/cli/lib/examples/signal-forms/05-dynamic-field-state-hidden.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export class ContactFormComponent {
8383
This file provides the template for the form, using an `@if` block to conditionally render a field based on its `hidden` signal.
8484

8585
```html
86-
<form (submit)="handleSubmit(); $event.preventDefault()">
86+
<form (submit)="handleSubmit(); $event.preventDefault()" novalidate>
8787
<div>
8888
<label>Reason for Contact:</label>
8989
<select [control]="contactForm.reason">
@@ -105,7 +105,7 @@ This file provides the template for the form, using an `@if` block to conditiona
105105
</div>
106106
}
107107

108-
<button type="submit" [disabled]="!contactForm().valid()">Submit</button>
108+
<button type="submit">Submit</button>
109109
</form>
110110
```
111111

packages/angular/cli/lib/examples/signal-forms/06-conditionally-disabling-fields.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export class PromoFormComponent {
8383
This file provides the template for the form, binding an input's `disabled` attribute to its corresponding field's `disabled` signal.
8484

8585
```html
86-
<form (submit)="handleSubmit(); $event.preventDefault()">
86+
<form (submit)="handleSubmit(); $event.preventDefault()" novalidate>
8787
<div>
8888
<label>
8989
<input type="checkbox" [control]="promoForm.hasPromoCode" />
@@ -105,7 +105,7 @@ This file provides the template for the form, binding an input's `disabled` attr
105105
}
106106
</div>
107107

108-
<button type="submit" [disabled]="!promoForm().valid()">Apply</button>
108+
<button type="submit">Apply</button>
109109
</form>
110110
```
111111

packages/angular/cli/lib/examples/signal-forms/07-dynamic-arrays.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export class SurveyFormComponent {
104104
This file provides the template for the form, using an `@for` block to render the fields for each question in the array.
105105

106106
```html
107-
<form (submit)="handleSubmit(); $event.preventDefault()">
107+
<form (submit)="handleSubmit(); $event.preventDefault()" novalidate>
108108
<div>
109109
<label>
110110
Survey Title:
@@ -134,7 +134,7 @@ This file provides the template for the form, using an `@for` block to render th
134134
}
135135

136136
<button type="button" (click)="addQuestion()">Add Question</button>
137-
<button type="submit" [disabled]="!surveyForm().valid()">Submit Survey</button>
137+
<button type="submit">Submit Survey</button>
138138
</form>
139139
```
140140

packages/angular/cli/lib/examples/signal-forms/08-custom-form-control.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export class ProductFormComponent {
108108
This file provides the template for the parent form, showing how the `[control]` directive is used on the custom component.
109109

110110
```html
111-
<form (submit)="handleSubmit(); $event.preventDefault()">
111+
<form (submit)="handleSubmit(); $event.preventDefault()" novalidate>
112112
<div>
113113
<label>
114114
Product Name:

packages/angular/cli/lib/examples/signal-forms/09-async-validation.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export class RegistrationFormComponent {
8585
This file provides the template for the form, showing how to display feedback while the asynchronous validation is pending.
8686

8787
```html
88-
<form (submit)="handleSubmit(); $event.preventDefault()">
88+
<form (submit)="handleSubmit(); $event.preventDefault()" novalidate>
8989
<div>
9090
<label>
9191
Username:
@@ -104,9 +104,7 @@ This file provides the template for the form, showing how to display feedback wh
104104
}
105105
</div>
106106

107-
<button type="submit" [disabled]="!registrationForm().valid() || registrationForm().pending()">
108-
Submit
109-
</button>
107+
<button type="submit" [disabled]="registrationForm().pending()">Submit</button>
110108
</form>
111109
```
112110

packages/angular/cli/lib/examples/signal-forms/10-debounced-async-validation.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export class RegistrationFormComponent implements OnDestroy {
113113
This file provides the template for the form, showing how to disable the submit button while validation is in progress.
114114

115115
```html
116-
<form (submit)="handleSubmit(); $event.preventDefault()">
116+
<form (submit)="handleSubmit(); $event.preventDefault()" novalidate>
117117
<div>
118118
<label>
119119
Username:
@@ -132,9 +132,7 @@ This file provides the template for the form, showing how to disable the submit
132132
}
133133
</div>
134134

135-
<button type="submit" [disabled]="!registrationForm().valid() || registrationForm().pending()">
136-
Submit
137-
</button>
135+
<button type="submit" [disabled]="registrationForm().pending()">Submit</button>
138136
</form>
139137
```
140138

0 commit comments

Comments
 (0)