[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7155YMD703SGV7RHP61BM59":3,"skill-same:01M7155YMD703SGV7RHP61BM59":80},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":44,"linkOnly":45,"markdownContent":46,"markdownBody":47,"frontMatter":48,"refName":50,"commitSha":51,"skillDirectory":52,"forksCount":14,"repositoryHtmlUrl":53,"repositoryHomepageUrl":6,"ownerHtmlUrl":54,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":55,"install":56,"resources":69},"01M7155YMD703SGV7RHP61BM59","angular-ui-patterns",null,"Modern Angular UI patterns for loading states, error handling, and data display. Use when building UI components, handling async data, or managing component states.","sapsapshen\u002Fai-memory-router","sapsapshen","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F20347959?v=4","01M6XDQEF1DP50DKF37H81J3J5","shenmian","01M6XDQEJPE41Y3DT2763X8ZJN",0,"MIT","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Fangular-ui-patterns\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000032","设计师","PROFESSION","适用职业",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43],"ui patterns","ui","patterns","angular ui patterns","angular","use","async","ui components","for","data","safe","2026","component","self","display","components","when","loading","states","error","2026-11-10 10:12:30",false,"---\nname: angular-ui-patterns\ndescription: \"Modern Angular UI patterns for loading states, error handling, and data display. Use when building UI components, handling async data, or managing component states.\"\nrisk: safe\nsource: self\ndate_added: \"2026-02-27\"\n---\n\n# Angular UI Patterns\n\n## Core Principles\n\n1. **Never show stale UI** - Loading states only when actually loading\n2. **Always surface errors** - Users must know when something fails\n3. **Optimistic updates** - Make the UI feel instant\n4. **Progressive disclosure** - Use `@defer` to show content as available\n5. **Graceful degradation** - Partial data is better than no data\n\n---\n\n## Loading State Patterns\n\n### The Golden Rule\n\n**Show loading indicator ONLY when there's no data to display.**\n\n```typescript\n@Component({\n  template: `\n    @if (error()) {\n      \u003Capp-error-state [error]=\"error()\" (retry)=\"load()\" \u002F>\n    } @else if (loading() && !items().length) {\n      \u003Capp-skeleton-list \u002F>\n    } @else if (!items().length) {\n      \u003Capp-empty-state message=\"No items found\" \u002F>\n    } @else {\n      \u003Capp-item-list [items]=\"items()\" \u002F>\n    }\n  `,\n})\nexport class ItemListComponent {\n  private store = inject(ItemStore);\n\n  items = this.store.items;\n  loading = this.store.loading;\n  error = this.store.error;\n}\n```\n\n### Loading State Decision Tree\n\n```\nIs there an error?\n  → Yes: Show error state with retry option\n  → No: Continue\n\nIs it loading AND we have no data?\n  → Yes: Show loading indicator (spinner\u002Fskeleton)\n  → No: Continue\n\nDo we have data?\n  → Yes, with items: Show the data\n  → Yes, but empty: Show empty state\n  → No: Show loading (fallback)\n```\n\n### Skeleton vs Spinner\n\n| Use Skeleton When    | Use Spinner When      |\n| -------------------- | --------------------- |\n| Known content shape  | Unknown content shape |\n| List\u002Fcard layouts    | Modal actions         |\n| Initial page load    | Button submissions    |\n| Content placeholders | Inline operations     |\n\n---\n\n## Control Flow Patterns\n\n### @if\u002F@else for Conditional Rendering\n\n```html\n@if (user(); as user) {\n\u003Cspan>Welcome, {{ user.name }}\u003C\u002Fspan>\n} @else if (loading()) {\n\u003Capp-spinner size=\"small\" \u002F>\n} @else {\n\u003Ca routerLink=\"\u002Flogin\">Sign In\u003C\u002Fa>\n}\n```\n\n### @for with Track\n\n```html\n@for (item of items(); track item.id) {\n\u003Capp-item-card [item]=\"item\" (delete)=\"remove(item.id)\" \u002F>\n} @empty {\n\u003Capp-empty-state\n  icon=\"inbox\"\n  message=\"No items yet\"\n  actionLabel=\"Create Item\"\n  (action)=\"create()\"\n\u002F>\n}\n```\n\n### @defer for Progressive Loading\n\n```html\n\u003C!-- Critical content loads immediately -->\n\u003Capp-header \u002F>\n\u003Capp-hero-section \u002F>\n\n\u003C!-- Non-critical content deferred -->\n@defer (on viewport) {\n\u003Capp-comments [postId]=\"postId()\" \u002F>\n} @placeholder {\n\u003Cdiv class=\"h-32 bg-gray-100 animate-pulse\">\u003C\u002Fdiv>\n} @loading (minimum 200ms) {\n\u003Capp-spinner \u002F>\n} @error {\n\u003Capp-error-state message=\"Failed to load comments\" \u002F>\n}\n```\n\n---\n\n## Error Handling Patterns\n\n### Error Handling Hierarchy\n\n```\n1. Inline error (field-level) → Form validation errors\n2. Toast notification → Recoverable errors, user can retry\n3. Error banner → Page-level errors, data still partially usable\n4. Full error screen → Unrecoverable, needs user action\n```\n\n### Always Show Errors\n\n**CRITICAL: Never swallow errors silently.**\n\n```typescript\n\u002F\u002F CORRECT - Error always surfaced to user\n@Component({...})\nexport class CreateItemComponent {\n  private store = inject(ItemStore);\n  private toast = inject(ToastService);\n\n  async create(data: CreateItemDto) {\n    try {\n      await this.store.create(data);\n      this.toast.success('Item created successfully');\n      this.router.navigate(['\u002Fitems']);\n    } catch (error) {\n      console.error('createItem failed:', error);\n      this.toast.error('Failed to create item. Please try again.');\n    }\n  }\n}\n\n\u002F\u002F WRONG - Error silently caught\nasync create(data: CreateItemDto) {\n  try {\n    await this.store.create(data);\n  } catch (error) {\n    console.error(error); \u002F\u002F User sees nothing!\n  }\n}\n```\n\n### Error State Component Pattern\n\n```typescript\n@Component({\n  selector: \"app-error-state\",\n  standalone: true,\n  imports: [NgOptimizedImage],\n  template: `\n    \u003Cdiv class=\"error-state\">\n      \u003Cimg ngSrc=\"\u002Fassets\u002Ferror-icon.svg\" width=\"64\" height=\"64\" alt=\"\" \u002F>\n      \u003Ch3>{{ title() }}\u003C\u002Fh3>\n      \u003Cp>{{ message() }}\u003C\u002Fp>\n      @if (retry.observed) {\n        \u003Cbutton (click)=\"retry.emit()\" class=\"btn-primary\">Try Again\u003C\u002Fbutton>\n      }\n    \u003C\u002Fdiv>\n  `,\n})\nexport class ErrorStateComponent {\n  title = input(\"Something went wrong\");\n  message = input(\"An unexpected error occurred\");\n  retry = output\u003Cvoid>();\n}\n```\n\n---\n\n## Button State Patterns\n\n### Button Loading State\n\n```html\n\u003Cbutton\n  (click)=\"handleSubmit()\"\n  [disabled]=\"isSubmitting() || !form.valid\"\n  class=\"btn-primary\"\n>\n  @if (isSubmitting()) {\n  \u003Capp-spinner size=\"small\" class=\"mr-2\" \u002F>\n  Saving... } @else { Save Changes }\n\u003C\u002Fbutton>\n```\n\n### Disable During Operations\n\n**CRITICAL: Always disable triggers during async operations.**\n\n```typescript\n\u002F\u002F CORRECT - Button disabled while loading\n@Component({\n  template: `\n    \u003Cbutton\n      [disabled]=\"saving()\"\n      (click)=\"save()\"\n    >\n      @if (saving()) {\n        \u003Capp-spinner size=\"sm\" \u002F> Saving...\n      } @else {\n        Save\n      }\n    \u003C\u002Fbutton>\n  `\n})\nexport class SaveButtonComponent {\n  saving = signal(false);\n\n  async save() {\n    this.saving.set(true);\n    try {\n      await this.service.save();\n    } finally {\n      this.saving.set(false);\n    }\n  }\n}\n\n\u002F\u002F WRONG - User can click multiple times\n\u003Cbutton (click)=\"save()\">\n  {{ saving() ? 'Saving...' : 'Save' }}\n\u003C\u002Fbutton>\n```\n\n---\n\n## Empty States\n\n### Empty State Requirements\n\nEvery list\u002Fcollection MUST have an empty state:\n\n```html\n@for (item of items(); track item.id) {\n\u003Capp-item-card [item]=\"item\" \u002F>\n} @empty {\n\u003Capp-empty-state\n  icon=\"folder-open\"\n  title=\"No items yet\"\n  description=\"Create your first item to get started\"\n  actionLabel=\"Create Item\"\n  (action)=\"openCreateDialog()\"\n\u002F>\n}\n```\n\n### Contextual Empty States\n\n```typescript\n@Component({\n  selector: \"app-empty-state\",\n  template: `\n    \u003Cdiv class=\"empty-state\">\n      \u003Cspan class=\"icon\" [class]=\"icon()\">\u003C\u002Fspan>\n      \u003Ch3>{{ title() }}\u003C\u002Fh3>\n      \u003Cp>{{ description() }}\u003C\u002Fp>\n      @if (actionLabel()) {\n        \u003Cbutton (click)=\"action.emit()\" class=\"btn-primary\">\n          {{ actionLabel() }}\n        \u003C\u002Fbutton>\n      }\n    \u003C\u002Fdiv>\n  `,\n})\nexport class EmptyStateComponent {\n  icon = input(\"inbox\");\n  title = input.required\u003Cstring>();\n  description = input(\"\");\n  actionLabel = input\u003Cstring | null>(null);\n  action = output\u003Cvoid>();\n}\n```\n\n---\n\n## Form Patterns\n\n### Form with Loading and Validation\n\n```typescript\n@Component({\n  template: `\n    \u003Cform [formGroup]=\"form\" (ngSubmit)=\"onSubmit()\">\n      \u003Cdiv class=\"form-field\">\n        \u003Clabel for=\"name\">Name\u003C\u002Flabel>\n        \u003Cinput\n          id=\"name\"\n          formControlName=\"name\"\n          [class.error]=\"isFieldInvalid('name')\"\n        \u002F>\n        @if (isFieldInvalid(\"name\")) {\n          \u003Cspan class=\"error-text\">\n            {{ getFieldError(\"name\") }}\n          \u003C\u002Fspan>\n        }\n      \u003C\u002Fdiv>\n\n      \u003Cdiv class=\"form-field\">\n        \u003Clabel for=\"email\">Email\u003C\u002Flabel>\n        \u003Cinput id=\"email\" type=\"email\" formControlName=\"email\" \u002F>\n        @if (isFieldInvalid(\"email\")) {\n          \u003Cspan class=\"error-text\">\n            {{ getFieldError(\"email\") }}\n          \u003C\u002Fspan>\n        }\n      \u003C\u002Fdiv>\n\n      \u003Cbutton type=\"submit\" [disabled]=\"form.invalid || submitting()\">\n        @if (submitting()) {\n          \u003Capp-spinner size=\"sm\" \u002F> Submitting...\n        } @else {\n          Submit\n        }\n      \u003C\u002Fbutton>\n    \u003C\u002Fform>\n  `,\n})\nexport class UserFormComponent {\n  private fb = inject(FormBuilder);\n\n  submitting = signal(false);\n\n  form = this.fb.group({\n    name: [\"\", [Validators.required, Validators.minLength(2)]],\n    email: [\"\", [Validators.required, Validators.email]],\n  });\n\n  isFieldInvalid(field: string): boolean {\n    const control = this.form.get(field);\n    return control ? control.invalid && control.touched : false;\n  }\n\n  getFieldError(field: string): string {\n    const control = this.form.get(field);\n    if (control?.hasError(\"required\")) return \"This field is required\";\n    if (control?.hasError(\"email\")) return \"Invalid email format\";\n    if (control?.hasError(\"minlength\")) return \"Too short\";\n    return \"\";\n  }\n\n  async onSubmit() {\n    if (this.form.invalid) return;\n\n    this.submitting.set(true);\n    try {\n      await this.service.submit(this.form.value);\n      this.toast.success(\"Submitted successfully\");\n    } catch {\n      this.toast.error(\"Submission failed\");\n    } finally {\n      this.submitting.set(false);\n    }\n  }\n}\n```\n\n---\n\n## Dialog\u002FModal Patterns\n\n### Confirmation Dialog\n\n```typescript\n\u002F\u002F dialog.service.ts\n@Injectable({ providedIn: 'root' })\nexport class DialogService {\n  private dialog = inject(Dialog); \u002F\u002F CDK Dialog or custom\n\n  async confirm(options: {\n    title: string;\n    message: string;\n    confirmText?: string;\n    cancelText?: string;\n  }): Promise\u003Cboolean> {\n    const dialogRef = this.dialog.open(ConfirmDialogComponent, {\n      data: options,\n    });\n\n    return await firstValueFrom(dialogRef.closed) ?? false;\n  }\n}\n\n\u002F\u002F Usage\nasync deleteItem(item: Item) {\n  const confirmed = await this.dialog.confirm({\n    title: 'Delete Item',\n    message: `Are you sure you want to delete \"${item.name}\"?`,\n    confirmText: 'Delete',\n  });\n\n  if (confirmed) {\n    await this.store.delete(item.id);\n  }\n}\n```\n\n---\n\n## Anti-Patterns\n\n### Loading States\n\n```typescript\n\u002F\u002F WRONG - Spinner when data exists (causes flash on refetch)\n@if (loading()) {\n  \u003Capp-spinner \u002F>\n}\n\n\u002F\u002F CORRECT - Only show loading without data\n@if (loading() && !items().length) {\n  \u003Capp-spinner \u002F>\n}\n```\n\n### Error Handling\n\n```typescript\n\u002F\u002F WRONG - Error swallowed\ntry {\n  await this.service.save();\n} catch (e) {\n  console.log(e); \u002F\u002F User has no idea!\n}\n\n\u002F\u002F CORRECT - Error surfaced\ntry {\n  await this.service.save();\n} catch (e) {\n  console.error(\"Save failed:\", e);\n  this.toast.error(\"Failed to save. Please try again.\");\n}\n```\n\n### Button States\n\n```html\n\u003C!-- WRONG - Button not disabled during submission -->\n\u003Cbutton (click)=\"submit()\">Submit\u003C\u002Fbutton>\n\n\u003C!-- CORRECT - Disabled and shows loading -->\n\u003Cbutton (click)=\"submit()\" [disabled]=\"loading()\">\n  @if (loading()) {\n  \u003Capp-spinner size=\"sm\" \u002F>\n  } Submit\n\u003C\u002Fbutton>\n```\n\n---\n\n## UI State Checklist\n\nBefore completing any UI component:\n\n### UI States\n\n- [ ] Error state handled and shown to user\n- [ ] Loading state shown only when no data exists\n- [ ] Empty state provided for collections (`@empty` block)\n- [ ] Buttons disabled during async operations\n- [ ] Buttons show loading indicator when appropriate\n\n### Data & Mutations\n\n- [ ] All async operations have error handling\n- [ ] All user actions have feedback (toast\u002Fvisual)\n- [ ] Optimistic updates rollback on failure\n\n### Accessibility\n\n- [ ] Loading states announced to screen readers\n- [ ] Error messages linked to form fields\n- [ ] Focus management after state changes\n\n---\n\n## Integration with Other Skills\n\n- **angular-state-management**: Use Signal stores for state\n- **angular**: Apply modern patterns (Signals, @defer)\n- **testing-patterns**: Test all UI states\n\n## When to Use\nThis skill is applicable to execute the workflow or actions described in the overview.\n","# Angular UI Patterns\n\n## Core Principles\n\n1. **Never show stale UI** - Loading states only when actually loading\n2. **Always surface errors** - Users must know when something fails\n3. **Optimistic updates** - Make the UI feel instant\n4. **Progressive disclosure** - Use `@defer` to show content as available\n5. **Graceful degradation** - Partial data is better than no data\n\n---\n\n## Loading State Patterns\n\n### The Golden Rule\n\n**Show loading indicator ONLY when there's no data to display.**\n\n```typescript\n@Component({\n  template: `\n    @if (error()) {\n      \u003Capp-error-state [error]=\"error()\" (retry)=\"load()\" \u002F>\n    } @else if (loading() && !items().length) {\n      \u003Capp-skeleton-list \u002F>\n    } @else if (!items().length) {\n      \u003Capp-empty-state message=\"No items found\" \u002F>\n    } @else {\n      \u003Capp-item-list [items]=\"items()\" \u002F>\n    }\n  `,\n})\nexport class ItemListComponent {\n  private store = inject(ItemStore);\n\n  items = this.store.items;\n  loading = this.store.loading;\n  error = this.store.error;\n}\n```\n\n### Loading State Decision Tree\n\n```\nIs there an error?\n  → Yes: Show error state with retry option\n  → No: Continue\n\nIs it loading AND we have no data?\n  → Yes: Show loading indicator (spinner\u002Fskeleton)\n  → No: Continue\n\nDo we have data?\n  → Yes, with items: Show the data\n  → Yes, but empty: Show empty state\n  → No: Show loading (fallback)\n```\n\n### Skeleton vs Spinner\n\n| Use Skeleton When    | Use Spinner When      |\n| -------------------- | --------------------- |\n| Known content shape  | Unknown content shape |\n| List\u002Fcard layouts    | Modal actions         |\n| Initial page load    | Button submissions    |\n| Content placeholders | Inline operations     |\n\n---\n\n## Control Flow Patterns\n\n### @if\u002F@else for Conditional Rendering\n\n```html\n@if (user(); as user) {\n\u003Cspan>Welcome, {{ user.name }}\u003C\u002Fspan>\n} @else if (loading()) {\n\u003Capp-spinner size=\"small\" \u002F>\n} @else {\n\u003Ca routerLink=\"\u002Flogin\">Sign In\u003C\u002Fa>\n}\n```\n\n### @for with Track\n\n```html\n@for (item of items(); track item.id) {\n\u003Capp-item-card [item]=\"item\" (delete)=\"remove(item.id)\" \u002F>\n} @empty {\n\u003Capp-empty-state\n  icon=\"inbox\"\n  message=\"No items yet\"\n  actionLabel=\"Create Item\"\n  (action)=\"create()\"\n\u002F>\n}\n```\n\n### @defer for Progressive Loading\n\n```html\n\u003C!-- Critical content loads immediately -->\n\u003Capp-header \u002F>\n\u003Capp-hero-section \u002F>\n\n\u003C!-- Non-critical content deferred -->\n@defer (on viewport) {\n\u003Capp-comments [postId]=\"postId()\" \u002F>\n} @placeholder {\n\u003Cdiv class=\"h-32 bg-gray-100 animate-pulse\">\u003C\u002Fdiv>\n} @loading (minimum 200ms) {\n\u003Capp-spinner \u002F>\n} @error {\n\u003Capp-error-state message=\"Failed to load comments\" \u002F>\n}\n```\n\n---\n\n## Error Handling Patterns\n\n### Error Handling Hierarchy\n\n```\n1. Inline error (field-level) → Form validation errors\n2. Toast notification → Recoverable errors, user can retry\n3. Error banner → Page-level errors, data still partially usable\n4. Full error screen → Unrecoverable, needs user action\n```\n\n### Always Show Errors\n\n**CRITICAL: Never swallow errors silently.**\n\n```typescript\n\u002F\u002F CORRECT - Error always surfaced to user\n@Component({...})\nexport class CreateItemComponent {\n  private store = inject(ItemStore);\n  private toast = inject(ToastService);\n\n  async create(data: CreateItemDto) {\n    try {\n      await this.store.create(data);\n      this.toast.success('Item created successfully');\n      this.router.navigate(['\u002Fitems']);\n    } catch (error) {\n      console.error('createItem failed:', error);\n      this.toast.error('Failed to create item. Please try again.');\n    }\n  }\n}\n\n\u002F\u002F WRONG - Error silently caught\nasync create(data: CreateItemDto) {\n  try {\n    await this.store.create(data);\n  } catch (error) {\n    console.error(error); \u002F\u002F User sees nothing!\n  }\n}\n```\n\n### Error State Component Pattern\n\n```typescript\n@Component({\n  selector: \"app-error-state\",\n  standalone: true,\n  imports: [NgOptimizedImage],\n  template: `\n    \u003Cdiv class=\"error-state\">\n      \u003Cimg ngSrc=\"\u002Fassets\u002Ferror-icon.svg\" width=\"64\" height=\"64\" alt=\"\" \u002F>\n      \u003Ch3>{{ title() }}\u003C\u002Fh3>\n      \u003Cp>{{ message() }}\u003C\u002Fp>\n      @if (retry.observed) {\n        \u003Cbutton (click)=\"retry.emit()\" class=\"btn-primary\">Try Again\u003C\u002Fbutton>\n      }\n    \u003C\u002Fdiv>\n  `,\n})\nexport class ErrorStateComponent {\n  title = input(\"Something went wrong\");\n  message = input(\"An unexpected error occurred\");\n  retry = output\u003Cvoid>();\n}\n```\n\n---\n\n## Button State Patterns\n\n### Button Loading State\n\n```html\n\u003Cbutton\n  (click)=\"handleSubmit()\"\n  [disabled]=\"isSubmitting() || !form.valid\"\n  class=\"btn-primary\"\n>\n  @if (isSubmitting()) {\n  \u003Capp-spinner size=\"small\" class=\"mr-2\" \u002F>\n  Saving... } @else { Save Changes }\n\u003C\u002Fbutton>\n```\n\n### Disable During Operations\n\n**CRITICAL: Always disable triggers during async operations.**\n\n```typescript\n\u002F\u002F CORRECT - Button disabled while loading\n@Component({\n  template: `\n    \u003Cbutton\n      [disabled]=\"saving()\"\n      (click)=\"save()\"\n    >\n      @if (saving()) {\n        \u003Capp-spinner size=\"sm\" \u002F> Saving...\n      } @else {\n        Save\n      }\n    \u003C\u002Fbutton>\n  `\n})\nexport class SaveButtonComponent {\n  saving = signal(false);\n\n  async save() {\n    this.saving.set(true);\n    try {\n      await this.service.save();\n    } finally {\n      this.saving.set(false);\n    }\n  }\n}\n\n\u002F\u002F WRONG - User can click multiple times\n\u003Cbutton (click)=\"save()\">\n  {{ saving() ? 'Saving...' : 'Save' }}\n\u003C\u002Fbutton>\n```\n\n---\n\n## Empty States\n\n### Empty State Requirements\n\nEvery list\u002Fcollection MUST have an empty state:\n\n```html\n@for (item of items(); track item.id) {\n\u003Capp-item-card [item]=\"item\" \u002F>\n} @empty {\n\u003Capp-empty-state\n  icon=\"folder-open\"\n  title=\"No items yet\"\n  description=\"Create your first item to get started\"\n  actionLabel=\"Create Item\"\n  (action)=\"openCreateDialog()\"\n\u002F>\n}\n```\n\n### Contextual Empty States\n\n```typescript\n@Component({\n  selector: \"app-empty-state\",\n  template: `\n    \u003Cdiv class=\"empty-state\">\n      \u003Cspan class=\"icon\" [class]=\"icon()\">\u003C\u002Fspan>\n      \u003Ch3>{{ title() }}\u003C\u002Fh3>\n      \u003Cp>{{ description() }}\u003C\u002Fp>\n      @if (actionLabel()) {\n        \u003Cbutton (click)=\"action.emit()\" class=\"btn-primary\">\n          {{ actionLabel() }}\n        \u003C\u002Fbutton>\n      }\n    \u003C\u002Fdiv>\n  `,\n})\nexport class EmptyStateComponent {\n  icon = input(\"inbox\");\n  title = input.required\u003Cstring>();\n  description = input(\"\");\n  actionLabel = input\u003Cstring | null>(null);\n  action = output\u003Cvoid>();\n}\n```\n\n---\n\n## Form Patterns\n\n### Form with Loading and Validation\n\n```typescript\n@Component({\n  template: `\n    \u003Cform [formGroup]=\"form\" (ngSubmit)=\"onSubmit()\">\n      \u003Cdiv class=\"form-field\">\n        \u003Clabel for=\"name\">Name\u003C\u002Flabel>\n        \u003Cinput\n          id=\"name\"\n          formControlName=\"name\"\n          [class.error]=\"isFieldInvalid('name')\"\n        \u002F>\n        @if (isFieldInvalid(\"name\")) {\n          \u003Cspan class=\"error-text\">\n            {{ getFieldError(\"name\") }}\n          \u003C\u002Fspan>\n        }\n      \u003C\u002Fdiv>\n\n      \u003Cdiv class=\"form-field\">\n        \u003Clabel for=\"email\">Email\u003C\u002Flabel>\n        \u003Cinput id=\"email\" type=\"email\" formControlName=\"email\" \u002F>\n        @if (isFieldInvalid(\"email\")) {\n          \u003Cspan class=\"error-text\">\n            {{ getFieldError(\"email\") }}\n          \u003C\u002Fspan>\n        }\n      \u003C\u002Fdiv>\n\n      \u003Cbutton type=\"submit\" [disabled]=\"form.invalid || submitting()\">\n        @if (submitting()) {\n          \u003Capp-spinner size=\"sm\" \u002F> Submitting...\n        } @else {\n          Submit\n        }\n      \u003C\u002Fbutton>\n    \u003C\u002Fform>\n  `,\n})\nexport class UserFormComponent {\n  private fb = inject(FormBuilder);\n\n  submitting = signal(false);\n\n  form = this.fb.group({\n    name: [\"\", [Validators.required, Validators.minLength(2)]],\n    email: [\"\", [Validators.required, Validators.email]],\n  });\n\n  isFieldInvalid(field: string): boolean {\n    const control = this.form.get(field);\n    return control ? control.invalid && control.touched : false;\n  }\n\n  getFieldError(field: string): string {\n    const control = this.form.get(field);\n    if (control?.hasError(\"required\")) return \"This field is required\";\n    if (control?.hasError(\"email\")) return \"Invalid email format\";\n    if (control?.hasError(\"minlength\")) return \"Too short\";\n    return \"\";\n  }\n\n  async onSubmit() {\n    if (this.form.invalid) return;\n\n    this.submitting.set(true);\n    try {\n      await this.service.submit(this.form.value);\n      this.toast.success(\"Submitted successfully\");\n    } catch {\n      this.toast.error(\"Submission failed\");\n    } finally {\n      this.submitting.set(false);\n    }\n  }\n}\n```\n\n---\n\n## Dialog\u002FModal Patterns\n\n### Confirmation Dialog\n\n```typescript\n\u002F\u002F dialog.service.ts\n@Injectable({ providedIn: 'root' })\nexport class DialogService {\n  private dialog = inject(Dialog); \u002F\u002F CDK Dialog or custom\n\n  async confirm(options: {\n    title: string;\n    message: string;\n    confirmText?: string;\n    cancelText?: string;\n  }): Promise\u003Cboolean> {\n    const dialogRef = this.dialog.open(ConfirmDialogComponent, {\n      data: options,\n    });\n\n    return await firstValueFrom(dialogRef.closed) ?? false;\n  }\n}\n\n\u002F\u002F Usage\nasync deleteItem(item: Item) {\n  const confirmed = await this.dialog.confirm({\n    title: 'Delete Item',\n    message: `Are you sure you want to delete \"${item.name}\"?`,\n    confirmText: 'Delete',\n  });\n\n  if (confirmed) {\n    await this.store.delete(item.id);\n  }\n}\n```\n\n---\n\n## Anti-Patterns\n\n### Loading States\n\n```typescript\n\u002F\u002F WRONG - Spinner when data exists (causes flash on refetch)\n@if (loading()) {\n  \u003Capp-spinner \u002F>\n}\n\n\u002F\u002F CORRECT - Only show loading without data\n@if (loading() && !items().length) {\n  \u003Capp-spinner \u002F>\n}\n```\n\n### Error Handling\n\n```typescript\n\u002F\u002F WRONG - Error swallowed\ntry {\n  await this.service.save();\n} catch (e) {\n  console.log(e); \u002F\u002F User has no idea!\n}\n\n\u002F\u002F CORRECT - Error surfaced\ntry {\n  await this.service.save();\n} catch (e) {\n  console.error(\"Save failed:\", e);\n  this.toast.error(\"Failed to save. Please try again.\");\n}\n```\n\n### Button States\n\n```html\n\u003C!-- WRONG - Button not disabled during submission -->\n\u003Cbutton (click)=\"submit()\">Submit\u003C\u002Fbutton>\n\n\u003C!-- CORRECT - Disabled and shows loading -->\n\u003Cbutton (click)=\"submit()\" [disabled]=\"loading()\">\n  @if (loading()) {\n  \u003Capp-spinner size=\"sm\" \u002F>\n  } Submit\n\u003C\u002Fbutton>\n```\n\n---\n\n## UI State Checklist\n\nBefore completing any UI component:\n\n### UI States\n\n- [ ] Error state handled and shown to user\n- [ ] Loading state shown only when no data exists\n- [ ] Empty state provided for collections (`@empty` block)\n- [ ] Buttons disabled during async operations\n- [ ] Buttons show loading indicator when appropriate\n\n### Data & Mutations\n\n- [ ] All async operations have error handling\n- [ ] All user actions have feedback (toast\u002Fvisual)\n- [ ] Optimistic updates rollback on failure\n\n### Accessibility\n\n- [ ] Loading states announced to screen readers\n- [ ] Error messages linked to form fields\n- [ ] Focus management after state changes\n\n---\n\n## Integration with Other Skills\n\n- **angular-state-management**: Use Signal stores for state\n- **angular**: Apply modern patterns (Signals, @defer)\n- **testing-patterns**: Test all UI states\n\n## When to Use\nThis skill is applicable to execute the workflow or actions described in the overview.\n",{"name":5,"risk":34,"source":37,"date_added":49,"description":7},"2026-02-27","main","7a38d8e7073e61c16eda85681cb32fb68a8657a5","skills-store\u002Fcursor\u002Fangular-ui-patterns","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router","https:\u002F\u002Fgithub.com\u002Fsapsapshen","2026-04-14 21:12:12",{"source":8,"skillName":5,"commands":57,"prompt":67,"zipAvailable":68},[58,61,64],{"tool":59,"command":60},"npx","npx skills add sapsapshen\u002Fai-memory-router --skill angular-ui-patterns",{"tool":62,"command":63},"bunx","bunx skills add sapsapshen\u002Fai-memory-router --skill angular-ui-patterns",{"tool":65,"command":66},"pnpm","pnpm dlx skills add sapsapshen\u002Fai-memory-router --skill angular-ui-patterns","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Fangular-ui-patterns\u002FSKILL.md",true,[70,76],{"path":71,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":74,"sourceHtmlUrl":75},"metadata.json","REFERENCE","参考文档",632,"https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Fangular-ui-patterns\u002Fmetadata.json",{"path":77,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":78,"sourceHtmlUrl":79},"README.md",1666,"https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Fangular-ui-patterns\u002FREADME.md",[81,91,98,106,112,120],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":85,"licenseFileUrl":86,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":90},"01M72R8PZX1ABFHJGTYPA4CAF1","webapp-testing","To test local web applications, write native Python Playwright scripts.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fglobal\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fglobal\u002Fwebapp-testing\u002FSKILL.md",[],[],"2026-11-10 22:39:42",{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":90},"01M72QG37MMZNDY7X7GXPAK5W6","python-packaging","Comprehensive guide to creating, structuring, and distributing Python packages using modern packaging tools, pyproject.toml, and publishing to PyPI.","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fglobal\u002Fpython-packaging\u002FSKILL.md",[],[],{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":85,"licenseFileUrl":102,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":90},"01M72NXR0QMP9G46TW6A2DH59C","canvas-design","These are instructions for creating design philosophies - aesthetic movements that are then EXPRESSED VISUALLY. Output only .md files, .pdf files, and .png files.","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fglobal\u002Fcanvas-design\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fglobal\u002Fcanvas-design\u002FSKILL.md",[],[],{"skillNo":107,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":85,"licenseFileUrl":108,"sourceHtmlUrl":109,"categories":110,"keywords":111,"publishedAt":90},"01M72N55TK3EEQ4QK4AWDC2KZS","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Fwebapp-testing\u002FSKILL.md",[],[],{"skillNo":113,"name":114,"nameZh":6,"description":115,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":85,"licenseFileUrl":116,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":90},"01M72MTWC150CFAP4Y5GSNKF80","slack-gif-creator","A toolkit providing utilities and knowledge for creating animated GIFs optimized for Slack.","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Fslack-gif-creator\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Fslack-gif-creator\u002FSKILL.md",[],[],{"skillNo":121,"name":122,"nameZh":6,"description":123,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":85,"licenseFileUrl":124,"sourceHtmlUrl":125,"categories":126,"keywords":127,"publishedAt":90},"01M72KPT3VVNSP88MNAY466TZT","frontend-design","You are a frontend designer-engineer, not a layout generator.","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Ffrontend-design\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Ffrontend-design\u002FSKILL.md",[],[]]