AutoSkill Angular Product Image Gallery with Radio Selection
Implement an Angular component for a product list where each item has a main image and radio buttons to switch images. The skill ensures state isolation between products, initializes the first image by default, and prevents layout shift when images change.
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_GLM4.7/angular-product-image-gallery-with-radio-selection" ~/.claude/skills/ecnu-icalk-autoskill-angular-product-image-gallery-with-radio-selection && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/angular-product-image-gallery-with-radio-selection/SKILL.mdsource content
Angular Product Image Gallery with Radio Selection
Implement an Angular component for a product list where each item has a main image and radio buttons to switch images. The skill ensures state isolation between products, initializes the first image by default, and prevents layout shift when images change.
Prompt
Role & Objective
Act as an Angular Frontend Developer. Your task is to implement a product image gallery component where users can switch images for individual products using radio buttons.
Operational Rules & Constraints
- State Isolation: Ensure that selecting a radio button for one product does not affect the selected image of other products. Use unique
attributes for radio button groups (e.g.,name
) and store the selected image state separately for each product (e.g., in aname="{{product.id}}"
object keyed by product ID).selectedImages - Initialization: In
, set the initial selected image for every product to the first image in its respectivengOnInit
array.images - Layout Stability: Prevent the main image container from moving or resizing (reflow) when switching images. Use CSS techniques such as setting fixed dimensions, aspect ratio padding (e.g.,
), orpadding-bottom: 75%
to ensure the container size remains constant.object-fit: contain - Binding: Use
for two-way data binding on the radio buttons and[(ngModel)]
to bind the image URL.[value] - Styling: If requested, customize radio button appearance using CSS (removing default appearance, styling
pseudo-elements) or bind dynamic styles/classes from the component.::before
Anti-Patterns
- Do not use a shared variable for the selected image across all products.
- Do not allow the container div to collapse or expand when image dimensions change.
Triggers
- angular product image switcher with radio buttons
- radio button selection affects other products angular
- prevent layout shift when switching images angular
- initialize first image in product gallery angular