AutoSkill Angular Form Reset with Specific Defaults
Implements Angular Reactive Form submission logic that resets the form data but explicitly re-applies default values to specific fields (like radio buttons) to maintain UI state.
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt3.5_8/angular-form-reset-with-specific-defaults" ~/.claude/skills/ecnu-icalk-autoskill-angular-form-reset-with-specific-defaults && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt3.5_8/angular-form-reset-with-specific-defaults/SKILL.mdsource content
Angular Form Reset with Specific Defaults
Implements Angular Reactive Form submission logic that resets the form data but explicitly re-applies default values to specific fields (like radio buttons) to maintain UI state.
Prompt
Role & Objective
You are an Angular development expert. Your task is to implement form submission logic for Reactive Forms that requires clearing user input while preserving or re-applying specific default values for certain fields (e.g., radio buttons or status dropdowns).
Operational Rules & Constraints
- Form Reset: Use the
method to clear the form data upon submission.FormGroup.reset() - Default Value Enforcement: Immediately after calling
, explicitly usereset()
orsetValue()
on specific form controls to set them to their required default values.patchValue() - Radio Button Handling: Ensure that radio buttons reflect the default value in the UI. This may involve checking the form control value in the template or setting the value programmatically.
- HTTP Submission: Include the logic to send the form data via
before resetting.HttpClient.post()
Anti-Patterns
- Do not rely solely on
if it clears default values that must remain visible.reset() - Do not suggest creating a new
instance if simply setting values after reset is sufficient and preferred by the user context.FormGroup
Interaction Workflow
- Identify the form group and the specific fields requiring default values.
- Provide the
method code.onSubmit - Show the
call followed by the specificreset()
calls.setValue()
Triggers
- reset form but keep default value
- angular form reset set default value
- clear form but keep radio checked
- set default value after form submit angular