feat(angular): support markAsTouched() for angular signal forms
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 68/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- angular, typescript
- Lĩnh vực
- frontend
Hướng nghiên cứu
Bắt đầu với các điểm tích hợp Angular signal forms được formRoot, formField và ion-input sử dụng, sau đó tái hiện ví dụ submit trong đó form().markAsTouched() được gọi mà không focus vào trường. Hoàn tất khi markAsTouched() khiến ion-input nhận ion-touched thay vì ion-untouched, trong khi hành vi hiện có của formControl vẫn được giữ nguyên.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Prerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already include this feature request, without success.
Describe the Feature Request
I already took a look at https://github.com/ionic-team/ionic-framework/issues/30805 and I think Ionic currently doesn't support the markAsTouched() use case despite the opposite being stated.
Blurring out of a signal form field after focusing it correctly mark the field with the ion-touched class.
But calling markAsTouched() on a signal form doesn't work.
Describe the Use Case
I have a signal form like this:
<form [formRoot]="form" (submit)="onSubmit()">
<ion-input [formField]="form.field" />
<ion-button type="submit">Submit</ion-button>
</form>
export class AppComponent {
protected readonly form = form(signal({ field: '' }));
protected onSubmit(): void {
this.form().markAsTouched();
}
}
When clicking on the submit button (without focusing/blurring the input) the ng-touched class is correctly applied but I still have ion-untouched instead of ion-touched.
Describe Preferred Solution
The ion-touched class should be automatically added to the ion-input, like it does when using [formControl] instead of [formField].
Describe Alternatives
I'm currently fixing the problem by applying the class myself:
<ion-input [formField]="form.field" [class.ion-touched]="form.field().touched()" />
Related Code
No response
Additional Information
My app config providers includes provideSignalFormsConfig({ classes: NG_STATUS_CLASSES }) so that the ng-invalid, ng-touched, and other angular classes are automatically added by Angular, otherwise, [formField] no longer have ng-* classes applied by default like they used to have with [formControl]
- Ngôn ngữ chính
- TypeScript
- Star
- 52.7k
- Fork
- 13.3k
- Merge trung bình
- 2 ngày 20 giờ
- Pull request đã merge (30 ngày)
- 35
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ionic-team/ionic-framework
-
triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ionic-team/ionic-framework#31410 · 1 bình luận ·
-
triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ionic-team/ionic-framework#31314 ·
-
triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
ionic-team/ionic-framework#31291 ·
-
triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
ionic-team/ionic-framework#30738 ·
-
package: core type: bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
ionic-team/ionic-framework#29864 · 1 bình luận ·
Tất cả issue của ionic-team/ionic-framework
Issue tương tự
-
Browser Waiting for: Product Owner
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
getsentry/sentry-javascript#24577 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
agilepathway/label-checker#640 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
copse-dev/agent-pane#2953 ·
-
[aw] Upgrade available Đang mởagentic-workflows
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
githubnext/rig#534 ·
-
automation missing-model model-sync provider:pioneer
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
anomalyco/models.dev#7701 ·