Angular Components
ASecurityPut host bindings in the component decorator's `host` metadata. Bind to signal values by calling the signal in the binding expression. This keeps host behavior declared with the component and avoids `@HostBinding` and direct `ElementRef` mutation. ```ts import { booleanAttribute, ChangeDetectionStrategy, Component, input, } from '@angular/core'; @Component({ selector: 'app-status-pill', standalone: true, imports: [], changeDetection: ChangeDetectionStrategy.OnPush, host: { '[class.active]': '...
- 584 stars
- 0 votes
- 0 copies
- 3 views
- Added September 5, 2026
Security analysis
100/100Pro scans all 21 files and shows the line behind each finding
npx -y skills add HoangNguyen0403/agent-skills-standard --skill angular-components --agent claude-codeAre you the author of Angular Components?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/hoangnguyen0403-angular-components-93a27f89)# Binding host properties without `@HostBinding`
Put host bindings in the component decorator's `host` metadata. Bind to signal values by calling the signal in the binding expression. This keeps host behavior declared with the component and avoids `@HostBinding` and direct `ElementRef` mutation.
```ts
import {
booleanAttribute,
ChangeDetectionStrategy,
Component,
input,
} from '@angular/core';
@Component({
selector: 'app-status-pill',
standalone: true,
imports: [],
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
'[class.active]': 'isActive()',
'[attr.aria-disabled]': 'disabled()',
'[attr.data-status]': 'status()',
},
template: `<span>{{ status() }}</span>`,
})
export class StatusPillComponent {
readonly isActive = input(false, { transform: booleanAttribute });
readonly disabled = input(false, { transform: booleanAttribute });
readonly status = input.required<string>();
}
```
When `isActive`, `disabled`, or `status` changes, Angular updates the corresponding host class or attribute. Use the same `host` object for supported host listeners when needed; keep DOM manipulation in a directive or use `Renderer2` rather than mutating an `ElementRef` directly.
Files in this skill
- eval-1.baseline.md
- eval-1.with-skill.md
- eval-2.baseline.md
- eval-2.with-skill.md
- eval-3.baseline.md
- eval-3.with-skill.md
- eval-4.baseline.md
- eval-4.with-skill.md
- eval-5.baseline.md
- eval-5.with-skill.md
- eval-6.baseline.md
- eval-6.with-skill.md
- eval-7.baseline.md
- eval-7.with-skill.md
- eval-8.baseline.md
- eval-8.with-skill.md
- eval-9.baseline.md
- eval-9.with-skill.md
- trigger-1.md
- trigger-2.md
Attribution
Related skills
View all in development →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.