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]': '...
Scanned 9/5/2026
Install to Claude Code
npx -y skills add HoangNguyen0403/agent-skills-standard --skill angular-components --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Angular Components?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/hoangnguyen0403-angular-components-93a27f89)More formats (shields.io, HTML) on the badges page.
# 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.
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!