[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71BXCGZ0BPZE8H83ETH5R28":3,"skill-same:01M71BXCGZ0BPZE8H83ETH5R28":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":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":40,"linkOnly":41,"markdownContent":42,"markdownBody":43,"frontMatter":44,"refName":50,"commitSha":51,"skillDirectory":5,"forksCount":14,"repositoryHtmlUrl":52,"repositoryHomepageUrl":6,"ownerHtmlUrl":53,"ownerBlogUrl":54,"ownerDescription":55,"updatedAt":56,"install":57,"resources":70},"01M71BXCGZ0BPZE8H83ETH5R28","angular-directives",null,"Create custom directives in Angular v20+ for DOM manipulation and behavior extension. Use for attribute directives that modify element behavior\u002Fappearance, structural directives for portals\u002Foverlays, and host directives for composition. Triggers on creating reusable DOM behaviors, extending element functionality, or composing behaviors across components. Note - use native @if\u002F@for\u002F@switch for control flow, not custom structural directives.","agency-black\u002FSkills","agency-black","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F234862658?v=4","01M6HWVFPNGNR5N2CX9ECSAD57","agencia.black","01M719WF77BF3HN0N9FK1APEFY",0,"MIT","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fangular-directives\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fangular-directives\u002FSKILL.md",[],[20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39],"angular","directives","angular directives","triggers","modify","extending","custom","for","overlays","element","host","components","structural","across","switch","reusable","use","Composition","license","development","2026-11-10 10:12:30",false,"---\nname: angular-directives\ndescription: >-\n  Create custom directives in Angular v20+ for DOM manipulation and behavior\n  extension. Use for attribute directives that modify element\n  behavior\u002Fappearance, structural directives for portals\u002Foverlays, and host\n  directives for composition. Triggers on creating reusable DOM behaviors,\n  extending element functionality, or composing behaviors across components.\n  Note - use native @if\u002F@for\u002F@switch for control flow, not custom structural\n  directives.\nmetadata:\n  category: development\n  source:\n    repository: 'https:\u002F\u002Fgithub.com\u002Fanalogjs\u002Fangular-skills'\n    path: skills\u002Fangular-directives\n    license_path: LICENSE\n---\n\n# Angular Directives\n\nCreate custom directives for reusable DOM manipulation and behavior in Angular v20+.\n\n## Attribute Directives\n\nModify the appearance or behavior of an element:\n\n```typescript\nimport { Directive, input, effect, inject, ElementRef } from '@angular\u002Fcore';\n\n@Directive({\n  selector: '[appHighlight]',\n})\nexport class Highlight {\n  private el = inject(ElementRef\u003CHTMLElement>);\n  \n  \u002F\u002F Input with alias matching selector\n  color = input('yellow', { alias: 'appHighlight' });\n  \n  constructor() {\n    effect(() => {\n      this.el.nativeElement.style.backgroundColor = this.color();\n    });\n  }\n}\n\n\u002F\u002F Usage: \u003Cp appHighlight=\"lightblue\">Highlighted text\u003C\u002Fp>\n\u002F\u002F Usage: \u003Cp appHighlight>Default yellow highlight\u003C\u002Fp>\n```\n\n### Using host Property\n\nPrefer `host` over `@HostBinding`\u002F`@HostListener`:\n\n```typescript\n@Directive({\n  selector: '[appTooltip]',\n  host: {\n    '(mouseenter)': 'show()',\n    '(mouseleave)': 'hide()',\n    '[attr.aria-describedby]': 'tooltipId',\n  },\n})\nexport class Tooltip {\n  text = input.required\u003Cstring>({ alias: 'appTooltip' });\n  position = input\u003C'top' | 'bottom' | 'left' | 'right'>('top');\n  \n  tooltipId = `tooltip-${crypto.randomUUID()}`;\n  private tooltipEl: HTMLElement | null = null;\n  private el = inject(ElementRef\u003CHTMLElement>);\n  \n  show() {\n    this.tooltipEl = document.createElement('div');\n    this.tooltipEl.id = this.tooltipId;\n    this.tooltipEl.className = `tooltip tooltip-${this.position()}`;\n    this.tooltipEl.textContent = this.text();\n    this.tooltipEl.setAttribute('role', 'tooltip');\n    document.body.appendChild(this.tooltipEl);\n    this.positionTooltip();\n  }\n  \n  hide() {\n    this.tooltipEl?.remove();\n    this.tooltipEl = null;\n  }\n  \n  private positionTooltip() {\n    \u002F\u002F Position logic based on this.position() and this.el\n  }\n}\n\n\u002F\u002F Usage: \u003Cbutton appTooltip=\"Click to save\" position=\"bottom\">Save\u003C\u002Fbutton>\n```\n\n### Class and Style Manipulation\n\n```typescript\n@Directive({\n  selector: '[appButton]',\n  host: {\n    'class': 'btn',\n    '[class.btn-primary]': 'variant() === \"primary\"',\n    '[class.btn-secondary]': 'variant() === \"secondary\"',\n    '[class.btn-sm]': 'size() === \"small\"',\n    '[class.btn-lg]': 'size() === \"large\"',\n    '[class.disabled]': 'disabled()',\n    '[attr.disabled]': 'disabled() || null',\n  },\n})\nexport class Button {\n  variant = input\u003C'primary' | 'secondary'>('primary');\n  size = input\u003C'small' | 'medium' | 'large'>('medium');\n  disabled = input(false, { transform: booleanAttribute });\n}\n\n\u002F\u002F Usage: \u003Cbutton appButton variant=\"primary\" size=\"large\">Click\u003C\u002Fbutton>\n```\n\n### Event Handling\n\n```typescript\n@Directive({\n  selector: '[appClickOutside]',\n  host: {\n    '(document:click)': 'onDocumentClick($event)',\n  },\n})\nexport class ClickOutside {\n  private el = inject(ElementRef\u003CHTMLElement>);\n  \n  clickOutside = output\u003Cvoid>();\n  \n  onDocumentClick(event: MouseEvent) {\n    if (!this.el.nativeElement.contains(event.target as Node)) {\n      this.clickOutside.emit();\n    }\n  }\n}\n\n\u002F\u002F Usage: \u003Cdiv appClickOutside (clickOutside)=\"closeMenu()\">...\u003C\u002Fdiv>\n```\n\n### Keyboard Shortcuts\n\n```typescript\n@Directive({\n  selector: '[appShortcut]',\n  host: {\n    '(document:keydown)': 'onKeydown($event)',\n  },\n})\nexport class Shortcut {\n  key = input.required\u003Cstring>({ alias: 'appShortcut' });\n  ctrl = input(false, { transform: booleanAttribute });\n  shift = input(false, { transform: booleanAttribute });\n  alt = input(false, { transform: booleanAttribute });\n  \n  triggered = output\u003CKeyboardEvent>();\n  \n  onKeydown(event: KeyboardEvent) {\n    const keyMatch = event.key.toLowerCase() === this.key().toLowerCase();\n    const ctrlMatch = this.ctrl() ? event.ctrlKey || event.metaKey : !event.ctrlKey && !event.metaKey;\n    const shiftMatch = this.shift() ? event.shiftKey : !event.shiftKey;\n    const altMatch = this.alt() ? event.altKey : !event.altKey;\n    \n    if (keyMatch && ctrlMatch && shiftMatch && altMatch) {\n      event.preventDefault();\n      this.triggered.emit(event);\n    }\n  }\n}\n\n\u002F\u002F Usage: \u003Cbutton appShortcut=\"s\" ctrl (triggered)=\"save()\">Save (Ctrl+S)\u003C\u002Fbutton>\n```\n\n## Structural Directives\n\nUse structural directives for DOM manipulation beyond control flow (portals, overlays, dynamic insertion points). For conditionals and loops, use native `@if`, `@for`, `@switch`.\n\n### Portal Directive\n\nRender content in a different DOM location:\n\n```typescript\nimport { Directive, inject, TemplateRef, ViewContainerRef, OnInit, OnDestroy, input } from '@angular\u002Fcore';\n\n@Directive({\n  selector: '[appPortal]',\n})\nexport class Portal implements OnInit, OnDestroy {\n  private templateRef = inject(TemplateRef\u003Cany>);\n  private viewContainerRef = inject(ViewContainerRef);\n  private viewRef: EmbeddedViewRef\u003Cany> | null = null;\n  \n  \u002F\u002F Target container selector or element\n  target = input\u003Cstring | HTMLElement>('body', { alias: 'appPortal' });\n  \n  ngOnInit() {\n    const container = this.getContainer();\n    if (container) {\n      this.viewRef = this.viewContainerRef.createEmbeddedView(this.templateRef);\n      this.viewRef.rootNodes.forEach(node => container.appendChild(node));\n    }\n  }\n  \n  ngOnDestroy() {\n    this.viewRef?.destroy();\n  }\n  \n  private getContainer(): HTMLElement | null {\n    const target = this.target();\n    if (typeof target === 'string') {\n      return document.querySelector(target);\n    }\n    return target;\n  }\n}\n\n\u002F\u002F Usage: Render modal at body level\n\u002F\u002F \u003Cdiv *appPortal=\"'body'\">\n\u002F\u002F   \u003Cdiv class=\"modal\">Modal content\u003C\u002Fdiv>\n\u002F\u002F \u003C\u002Fdiv>\n```\n\n### Lazy Render Directive\n\nDefer rendering until condition is met (one-time):\n\n```typescript\n@Directive({\n  selector: '[appLazyRender]',\n})\nexport class LazyRender {\n  private templateRef = inject(TemplateRef\u003Cany>);\n  private viewContainer = inject(ViewContainerRef);\n  private rendered = false;\n  \n  condition = input.required\u003Cboolean>({ alias: 'appLazyRender' });\n  \n  constructor() {\n    effect(() => {\n      \u002F\u002F Only render once when condition becomes true\n      if (this.condition() && !this.rendered) {\n        this.viewContainer.createEmbeddedView(this.templateRef);\n        this.rendered = true;\n      }\n    });\n  }\n}\n\n\u002F\u002F Usage: Render heavy component only when tab is first activated\n\u002F\u002F \u003Cdiv *appLazyRender=\"activeTab() === 'reports'\">\n\u002F\u002F   \u003Capp-heavy-reports \u002F>\n\u002F\u002F \u003C\u002Fdiv>\n```\n\n### Template Outlet with Context\n\n```typescript\ninterface TemplateContext\u003CT> {\n  $implicit: T;\n  item: T;\n  index: number;\n}\n\n@Directive({\n  selector: '[appTemplateOutlet]',\n})\nexport class TemplateOutlet\u003CT> {\n  private viewContainer = inject(ViewContainerRef);\n  private currentView: EmbeddedViewRef\u003CTemplateContext\u003CT>> | null = null;\n  \n  template = input.required\u003CTemplateRef\u003CTemplateContext\u003CT>>>({ alias: 'appTemplateOutlet' });\n  context = input.required\u003CT>({ alias: 'appTemplateOutletContext' });\n  index = input(0, { alias: 'appTemplateOutletIndex' });\n  \n  constructor() {\n    effect(() => {\n      const template = this.template();\n      const context = this.context();\n      const index = this.index();\n      \n      if (this.currentView) {\n        this.currentView.context.$implicit = context;\n        this.currentView.context.item = context;\n        this.currentView.context.index = index;\n        this.currentView.markForCheck();\n      } else {\n        this.currentView = this.viewContainer.createEmbeddedView(template, {\n          $implicit: context,\n          item: context,\n          index,\n        });\n      }\n    });\n  }\n}\n\n\u002F\u002F Usage: Custom list with template\n\u002F\u002F \u003Cng-template #itemTemplate let-item let-i=\"index\">\n\u002F\u002F   \u003Cdiv>{{ i }}: {{ item.name }}\u003C\u002Fdiv>\n\u002F\u002F \u003C\u002Fng-template>\n\u002F\u002F \u003Cng-container \n\u002F\u002F   *appTemplateOutlet=\"itemTemplate; context: item; index: i\"\n\u002F\u002F \u002F>\n```\n\n## Host Directives\n\nCompose directives on components or other directives:\n\n```typescript\n\u002F\u002F Reusable behavior directives\n@Directive({\n  selector: '[focusable]',\n  host: {\n    'tabindex': '0',\n    '(focus)': 'onFocus()',\n    '(blur)': 'onBlur()',\n    '[class.focused]': 'isFocused()',\n  },\n})\nexport class Focusable {\n  isFocused = signal(false);\n  \n  onFocus() { this.isFocused.set(true); }\n  onBlur() { this.isFocused.set(false); }\n}\n\n@Directive({\n  selector: '[disableable]',\n  host: {\n    '[class.disabled]': 'disabled()',\n    '[attr.aria-disabled]': 'disabled()',\n  },\n})\nexport class Disableable {\n  disabled = input(false, { transform: booleanAttribute });\n}\n\n\u002F\u002F Component using host directives\n@Component({\n  selector: 'app-custom-button',\n  hostDirectives: [\n    Focusable,\n    {\n      directive: Disableable,\n      inputs: ['disabled'],\n    },\n  ],\n  host: {\n    'role': 'button',\n    '(click)': 'onClick($event)',\n    '(keydown.enter)': 'onClick($event)',\n    '(keydown.space)': 'onClick($event)',\n  },\n  template: `\u003Cng-content \u002F>`,\n})\nexport class CustomButton {\n  private disableable = inject(Disableable);\n  \n  clicked = output\u003Cvoid>();\n  \n  onClick(event: Event) {\n    if (!this.disableable.disabled()) {\n      this.clicked.emit();\n    }\n  }\n}\n\n\u002F\u002F Usage: \u003Capp-custom-button disabled>Click me\u003C\u002Fapp-custom-button>\n```\n\n### Exposing Host Directive Outputs\n\n```typescript\n@Directive({\n  selector: '[hoverable]',\n  host: {\n    '(mouseenter)': 'onEnter()',\n    '(mouseleave)': 'onLeave()',\n    '[class.hovered]': 'isHovered()',\n  },\n})\nexport class Hoverable {\n  isHovered = signal(false);\n  \n  hoverChange = output\u003Cboolean>();\n  \n  onEnter() {\n    this.isHovered.set(true);\n    this.hoverChange.emit(true);\n  }\n  \n  onLeave() {\n    this.isHovered.set(false);\n    this.hoverChange.emit(false);\n  }\n}\n\n@Component({\n  selector: 'app-card',\n  hostDirectives: [\n    {\n      directive: Hoverable,\n      outputs: ['hoverChange'],\n    },\n  ],\n  template: `\u003Cng-content \u002F>`,\n})\nexport class Card {}\n\n\u002F\u002F Usage: \u003Capp-card (hoverChange)=\"onHover($event)\">...\u003C\u002Fapp-card>\n```\n\n## Directive Composition API\n\nCombine multiple behaviors:\n\n```typescript\n\u002F\u002F Base directives\n@Directive({ selector: '[withRipple]' })\nexport class Ripple {\n  \u002F\u002F Ripple effect implementation\n}\n\n@Directive({ selector: '[withElevation]' })\nexport class Elevation {\n  elevation = input(2);\n}\n\n\u002F\u002F Composed component\n@Component({\n  selector: 'app-material-button',\n  hostDirectives: [\n    Ripple,\n    {\n      directive: Elevation,\n      inputs: ['elevation'],\n    },\n    {\n      directive: Disableable,\n      inputs: ['disabled'],\n    },\n  ],\n  template: `\u003Cng-content \u002F>`,\n})\nexport class MaterialButton {}\n```\n\nFor advanced patterns, see [references\u002Fdirective-patterns.md](references\u002Fdirective-patterns.md).\n","# Angular Directives\n\nCreate custom directives for reusable DOM manipulation and behavior in Angular v20+.\n\n## Attribute Directives\n\nModify the appearance or behavior of an element:\n\n```typescript\nimport { Directive, input, effect, inject, ElementRef } from '@angular\u002Fcore';\n\n@Directive({\n  selector: '[appHighlight]',\n})\nexport class Highlight {\n  private el = inject(ElementRef\u003CHTMLElement>);\n  \n  \u002F\u002F Input with alias matching selector\n  color = input('yellow', { alias: 'appHighlight' });\n  \n  constructor() {\n    effect(() => {\n      this.el.nativeElement.style.backgroundColor = this.color();\n    });\n  }\n}\n\n\u002F\u002F Usage: \u003Cp appHighlight=\"lightblue\">Highlighted text\u003C\u002Fp>\n\u002F\u002F Usage: \u003Cp appHighlight>Default yellow highlight\u003C\u002Fp>\n```\n\n### Using host Property\n\nPrefer `host` over `@HostBinding`\u002F`@HostListener`:\n\n```typescript\n@Directive({\n  selector: '[appTooltip]',\n  host: {\n    '(mouseenter)': 'show()',\n    '(mouseleave)': 'hide()',\n    '[attr.aria-describedby]': 'tooltipId',\n  },\n})\nexport class Tooltip {\n  text = input.required\u003Cstring>({ alias: 'appTooltip' });\n  position = input\u003C'top' | 'bottom' | 'left' | 'right'>('top');\n  \n  tooltipId = `tooltip-${crypto.randomUUID()}`;\n  private tooltipEl: HTMLElement | null = null;\n  private el = inject(ElementRef\u003CHTMLElement>);\n  \n  show() {\n    this.tooltipEl = document.createElement('div');\n    this.tooltipEl.id = this.tooltipId;\n    this.tooltipEl.className = `tooltip tooltip-${this.position()}`;\n    this.tooltipEl.textContent = this.text();\n    this.tooltipEl.setAttribute('role', 'tooltip');\n    document.body.appendChild(this.tooltipEl);\n    this.positionTooltip();\n  }\n  \n  hide() {\n    this.tooltipEl?.remove();\n    this.tooltipEl = null;\n  }\n  \n  private positionTooltip() {\n    \u002F\u002F Position logic based on this.position() and this.el\n  }\n}\n\n\u002F\u002F Usage: \u003Cbutton appTooltip=\"Click to save\" position=\"bottom\">Save\u003C\u002Fbutton>\n```\n\n### Class and Style Manipulation\n\n```typescript\n@Directive({\n  selector: '[appButton]',\n  host: {\n    'class': 'btn',\n    '[class.btn-primary]': 'variant() === \"primary\"',\n    '[class.btn-secondary]': 'variant() === \"secondary\"',\n    '[class.btn-sm]': 'size() === \"small\"',\n    '[class.btn-lg]': 'size() === \"large\"',\n    '[class.disabled]': 'disabled()',\n    '[attr.disabled]': 'disabled() || null',\n  },\n})\nexport class Button {\n  variant = input\u003C'primary' | 'secondary'>('primary');\n  size = input\u003C'small' | 'medium' | 'large'>('medium');\n  disabled = input(false, { transform: booleanAttribute });\n}\n\n\u002F\u002F Usage: \u003Cbutton appButton variant=\"primary\" size=\"large\">Click\u003C\u002Fbutton>\n```\n\n### Event Handling\n\n```typescript\n@Directive({\n  selector: '[appClickOutside]',\n  host: {\n    '(document:click)': 'onDocumentClick($event)',\n  },\n})\nexport class ClickOutside {\n  private el = inject(ElementRef\u003CHTMLElement>);\n  \n  clickOutside = output\u003Cvoid>();\n  \n  onDocumentClick(event: MouseEvent) {\n    if (!this.el.nativeElement.contains(event.target as Node)) {\n      this.clickOutside.emit();\n    }\n  }\n}\n\n\u002F\u002F Usage: \u003Cdiv appClickOutside (clickOutside)=\"closeMenu()\">...\u003C\u002Fdiv>\n```\n\n### Keyboard Shortcuts\n\n```typescript\n@Directive({\n  selector: '[appShortcut]',\n  host: {\n    '(document:keydown)': 'onKeydown($event)',\n  },\n})\nexport class Shortcut {\n  key = input.required\u003Cstring>({ alias: 'appShortcut' });\n  ctrl = input(false, { transform: booleanAttribute });\n  shift = input(false, { transform: booleanAttribute });\n  alt = input(false, { transform: booleanAttribute });\n  \n  triggered = output\u003CKeyboardEvent>();\n  \n  onKeydown(event: KeyboardEvent) {\n    const keyMatch = event.key.toLowerCase() === this.key().toLowerCase();\n    const ctrlMatch = this.ctrl() ? event.ctrlKey || event.metaKey : !event.ctrlKey && !event.metaKey;\n    const shiftMatch = this.shift() ? event.shiftKey : !event.shiftKey;\n    const altMatch = this.alt() ? event.altKey : !event.altKey;\n    \n    if (keyMatch && ctrlMatch && shiftMatch && altMatch) {\n      event.preventDefault();\n      this.triggered.emit(event);\n    }\n  }\n}\n\n\u002F\u002F Usage: \u003Cbutton appShortcut=\"s\" ctrl (triggered)=\"save()\">Save (Ctrl+S)\u003C\u002Fbutton>\n```\n\n## Structural Directives\n\nUse structural directives for DOM manipulation beyond control flow (portals, overlays, dynamic insertion points). For conditionals and loops, use native `@if`, `@for`, `@switch`.\n\n### Portal Directive\n\nRender content in a different DOM location:\n\n```typescript\nimport { Directive, inject, TemplateRef, ViewContainerRef, OnInit, OnDestroy, input } from '@angular\u002Fcore';\n\n@Directive({\n  selector: '[appPortal]',\n})\nexport class Portal implements OnInit, OnDestroy {\n  private templateRef = inject(TemplateRef\u003Cany>);\n  private viewContainerRef = inject(ViewContainerRef);\n  private viewRef: EmbeddedViewRef\u003Cany> | null = null;\n  \n  \u002F\u002F Target container selector or element\n  target = input\u003Cstring | HTMLElement>('body', { alias: 'appPortal' });\n  \n  ngOnInit() {\n    const container = this.getContainer();\n    if (container) {\n      this.viewRef = this.viewContainerRef.createEmbeddedView(this.templateRef);\n      this.viewRef.rootNodes.forEach(node => container.appendChild(node));\n    }\n  }\n  \n  ngOnDestroy() {\n    this.viewRef?.destroy();\n  }\n  \n  private getContainer(): HTMLElement | null {\n    const target = this.target();\n    if (typeof target === 'string') {\n      return document.querySelector(target);\n    }\n    return target;\n  }\n}\n\n\u002F\u002F Usage: Render modal at body level\n\u002F\u002F \u003Cdiv *appPortal=\"'body'\">\n\u002F\u002F   \u003Cdiv class=\"modal\">Modal content\u003C\u002Fdiv>\n\u002F\u002F \u003C\u002Fdiv>\n```\n\n### Lazy Render Directive\n\nDefer rendering until condition is met (one-time):\n\n```typescript\n@Directive({\n  selector: '[appLazyRender]',\n})\nexport class LazyRender {\n  private templateRef = inject(TemplateRef\u003Cany>);\n  private viewContainer = inject(ViewContainerRef);\n  private rendered = false;\n  \n  condition = input.required\u003Cboolean>({ alias: 'appLazyRender' });\n  \n  constructor() {\n    effect(() => {\n      \u002F\u002F Only render once when condition becomes true\n      if (this.condition() && !this.rendered) {\n        this.viewContainer.createEmbeddedView(this.templateRef);\n        this.rendered = true;\n      }\n    });\n  }\n}\n\n\u002F\u002F Usage: Render heavy component only when tab is first activated\n\u002F\u002F \u003Cdiv *appLazyRender=\"activeTab() === 'reports'\">\n\u002F\u002F   \u003Capp-heavy-reports \u002F>\n\u002F\u002F \u003C\u002Fdiv>\n```\n\n### Template Outlet with Context\n\n```typescript\ninterface TemplateContext\u003CT> {\n  $implicit: T;\n  item: T;\n  index: number;\n}\n\n@Directive({\n  selector: '[appTemplateOutlet]',\n})\nexport class TemplateOutlet\u003CT> {\n  private viewContainer = inject(ViewContainerRef);\n  private currentView: EmbeddedViewRef\u003CTemplateContext\u003CT>> | null = null;\n  \n  template = input.required\u003CTemplateRef\u003CTemplateContext\u003CT>>>({ alias: 'appTemplateOutlet' });\n  context = input.required\u003CT>({ alias: 'appTemplateOutletContext' });\n  index = input(0, { alias: 'appTemplateOutletIndex' });\n  \n  constructor() {\n    effect(() => {\n      const template = this.template();\n      const context = this.context();\n      const index = this.index();\n      \n      if (this.currentView) {\n        this.currentView.context.$implicit = context;\n        this.currentView.context.item = context;\n        this.currentView.context.index = index;\n        this.currentView.markForCheck();\n      } else {\n        this.currentView = this.viewContainer.createEmbeddedView(template, {\n          $implicit: context,\n          item: context,\n          index,\n        });\n      }\n    });\n  }\n}\n\n\u002F\u002F Usage: Custom list with template\n\u002F\u002F \u003Cng-template #itemTemplate let-item let-i=\"index\">\n\u002F\u002F   \u003Cdiv>{{ i }}: {{ item.name }}\u003C\u002Fdiv>\n\u002F\u002F \u003C\u002Fng-template>\n\u002F\u002F \u003Cng-container \n\u002F\u002F   *appTemplateOutlet=\"itemTemplate; context: item; index: i\"\n\u002F\u002F \u002F>\n```\n\n## Host Directives\n\nCompose directives on components or other directives:\n\n```typescript\n\u002F\u002F Reusable behavior directives\n@Directive({\n  selector: '[focusable]',\n  host: {\n    'tabindex': '0',\n    '(focus)': 'onFocus()',\n    '(blur)': 'onBlur()',\n    '[class.focused]': 'isFocused()',\n  },\n})\nexport class Focusable {\n  isFocused = signal(false);\n  \n  onFocus() { this.isFocused.set(true); }\n  onBlur() { this.isFocused.set(false); }\n}\n\n@Directive({\n  selector: '[disableable]',\n  host: {\n    '[class.disabled]': 'disabled()',\n    '[attr.aria-disabled]': 'disabled()',\n  },\n})\nexport class Disableable {\n  disabled = input(false, { transform: booleanAttribute });\n}\n\n\u002F\u002F Component using host directives\n@Component({\n  selector: 'app-custom-button',\n  hostDirectives: [\n    Focusable,\n    {\n      directive: Disableable,\n      inputs: ['disabled'],\n    },\n  ],\n  host: {\n    'role': 'button',\n    '(click)': 'onClick($event)',\n    '(keydown.enter)': 'onClick($event)',\n    '(keydown.space)': 'onClick($event)',\n  },\n  template: `\u003Cng-content \u002F>`,\n})\nexport class CustomButton {\n  private disableable = inject(Disableable);\n  \n  clicked = output\u003Cvoid>();\n  \n  onClick(event: Event) {\n    if (!this.disableable.disabled()) {\n      this.clicked.emit();\n    }\n  }\n}\n\n\u002F\u002F Usage: \u003Capp-custom-button disabled>Click me\u003C\u002Fapp-custom-button>\n```\n\n### Exposing Host Directive Outputs\n\n```typescript\n@Directive({\n  selector: '[hoverable]',\n  host: {\n    '(mouseenter)': 'onEnter()',\n    '(mouseleave)': 'onLeave()',\n    '[class.hovered]': 'isHovered()',\n  },\n})\nexport class Hoverable {\n  isHovered = signal(false);\n  \n  hoverChange = output\u003Cboolean>();\n  \n  onEnter() {\n    this.isHovered.set(true);\n    this.hoverChange.emit(true);\n  }\n  \n  onLeave() {\n    this.isHovered.set(false);\n    this.hoverChange.emit(false);\n  }\n}\n\n@Component({\n  selector: 'app-card',\n  hostDirectives: [\n    {\n      directive: Hoverable,\n      outputs: ['hoverChange'],\n    },\n  ],\n  template: `\u003Cng-content \u002F>`,\n})\nexport class Card {}\n\n\u002F\u002F Usage: \u003Capp-card (hoverChange)=\"onHover($event)\">...\u003C\u002Fapp-card>\n```\n\n## Directive Composition API\n\nCombine multiple behaviors:\n\n```typescript\n\u002F\u002F Base directives\n@Directive({ selector: '[withRipple]' })\nexport class Ripple {\n  \u002F\u002F Ripple effect implementation\n}\n\n@Directive({ selector: '[withElevation]' })\nexport class Elevation {\n  elevation = input(2);\n}\n\n\u002F\u002F Composed component\n@Component({\n  selector: 'app-material-button',\n  hostDirectives: [\n    Ripple,\n    {\n      directive: Elevation,\n      inputs: ['elevation'],\n    },\n    {\n      directive: Disableable,\n      inputs: ['disabled'],\n    },\n  ],\n  template: `\u003Cng-content \u002F>`,\n})\nexport class MaterialButton {}\n```\n\nFor advanced patterns, see [references\u002Fdirective-patterns.md](references\u002Fdirective-patterns.md).\n",{"name":5,"metadata":45,"description":7},{"source":46,"category":39},{"path":47,"repository":48,"license_path":49},"skills\u002Fangular-directives","https:\u002F\u002Fgithub.com\u002Fanalogjs\u002Fangular-skills","LICENSE","main","681496e0662f4c45c4758fae9d4510ae87311bf2","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills","https:\u002F\u002Fgithub.com\u002Fagency-black","http:\u002F\u002Fwww.dogma.black","Las grandes ideas merecen una ejecución impecable. Construimos plataformas web, aplicaciones y ecosistemas digitales completos. Esta Trinidad es nuestro dogma.","2026-05-29 16:13:55",{"source":8,"skillName":5,"commands":58,"prompt":68,"zipAvailable":69},[59,62,65],{"tool":60,"command":61},"npx","npx skills add agency-black\u002FSkills --skill angular-directives",{"tool":63,"command":64},"bunx","bunx skills add agency-black\u002FSkills --skill angular-directives",{"tool":66,"command":67},"pnpm","pnpm dlx skills add agency-black\u002FSkills --skill angular-directives","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fangular-directives\u002FSKILL.md",true,[71,74],{"path":49,"resourceType":49,"resourceTypeDesc":72,"sizeBytes":73,"sourceHtmlUrl":16},"许可证",1072,{"path":75,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":78,"sourceHtmlUrl":79},"references\u002Fdirective-patterns.md","REFERENCE","参考文档",12849,"https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fangular-directives\u002Freferences\u002Fdirective-patterns.md",[81,90,115,141,165,188],{"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":15,"licenseFileUrl":85,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":89},"01M73SXDAGZVNRAJMDVXWEE26Q","x-article-publisher","Publish Markdown articles to X (Twitter) Articles editor with proper formatting. Use when user wants to publish a Markdown file\u002FURL to X Articles, or mentions \"publish to X\", \"post article to Twitter\", \"X article\", or wants help with X Premium article publishing. Handles cover image upload and converts Markdown to rich text automatically.","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fqiaomu-x-article-publisher\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fqiaomu-x-article-publisher\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":40},"01M71JZVZ0TVW7Z5DQBRWSBG8A","zarr-python","Chunked N-D arrays for cloud storage (Zarr-Python 3). Compressed arrays, parallel I\u002FO, S3\u002FGCS via fsspec, NumPy\u002FDask\u002FXarray compatible, for large-scale scientific computing pipelines.","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fzarr-python\u002FSKILL.md",[],[97,98,99,100,101,102,103,104,36,105,27,106,107,108,109,110,111,112,113,114],"zarr","python","zarr python","scale","write","scientific computing","s3","numpy","s3fs","dask","parallel","edit","read","scientific","workflows","remote","Cloud Storage","arrays",{"skillNo":116,"name":117,"nameZh":6,"description":118,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":119,"sourceHtmlUrl":120,"categories":121,"keywords":122,"publishedAt":40},"01M71JYXC5VAEJT8KXN5GRK32S","xvary-stock-research","Thesis-driven equity analysis from public SEC EDGAR and market data; \u002Fanalyze, \u002Fscore, \u002Fcompare workflows with bundled Python tools (Claude Code, Cursor, Codex).","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fxvary-stock-research\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fxvary-stock-research\u002FSKILL.md",[],[123,124,125,126,127,128,129,130,131,132,111,133,98,134,135,136,137,138,139,140],"xvary stock research","research","stock","xvary","market data","compare","Market","code","analyze","analysis","thesis","equity","community","sec edgar","with","2026","cursor","codex",{"skillNo":142,"name":143,"nameZh":6,"description":144,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":145,"licenseFileUrl":146,"sourceHtmlUrl":147,"categories":148,"keywords":149,"publishedAt":40},"01M71JVSDPDQ5040YBN6J1ASKY","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fwebapp-testing\u002FSKILL.md",[],[150,151,152,153,154,155,156,157,137,158,159,160,161,162,163,164,27],"webapp","testing","webapp testing","screenshots","applications","behavior","web","playwright","browser","logs","toolkit","debugging","frontend","local","ui",{"skillNo":166,"name":167,"nameZh":6,"description":168,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":145,"licenseFileUrl":169,"sourceHtmlUrl":170,"categories":171,"keywords":172,"publishedAt":40},"01M71JV64CW7R6FYYK9JWWGW0X","web-artifacts-builder","Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn\u002Fui). Use for complex artifacts requiring state management, routing, or shadcn\u002Fui components - not for simple single-file HTML\u002FJSX artifacts.","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fweb-artifacts-builder\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fweb-artifacts-builder\u002FSKILL.md",[],[173,156,174,175,176,162,177,178,27,179,180,181,182,183,184,185,186,31,187,36],"web artifacts builder","artifacts","artifacts builder","builder","ui components","Tailwind","css","single-file","single","state management","routing","state","multi","react","file",{"skillNo":189,"name":190,"nameZh":6,"description":191,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":192,"categories":193,"keywords":194,"publishedAt":40},"01M71JS4X2FRY41DE84DEP06MN","vercel-react-view-transitions","Guide for implementing smooth, native-feeling animations using React's View Transition API (`\u003CViewTransition>` component, `addTransitionType`, and CSS view transition pseudo-elements). Use this skill whenever the user wants to add page transitions, animate route changes, create shared element animations, animate enter\u002Fexit of components, animate list reorder, implement directional (forward\u002Fback) navigation animations, or integrate view transitions in Next.js. Also use when the user mentions view transitions, `startViewTransition`, `ViewTransition`, transition types, or asks about animating between UI states in React without third-party animation libraries.","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fvercel-react-view-transitions\u002FSKILL.md",[],[195,186,196,197,198,199,31,200,201,202,203,204,205,29,206,207,179,208,209,210],"vercel react view transitions","transitions","vercel","react view transitions","view","libraries","create","route","api","when","implementing","states","types","Animation","back","shared"]