Angular Components
ASecurityDeclare the component with `standalone: true`, import every directive or component it uses in the component's `imports` array, and use `OnPush` change detection. With Angular's built-in control flow, simple interpolation and event binding do not require `CommonModule`. ```ts import { ChangeDetectionStrategy, Component, input, output } from '@angular/core'; @Component({ selector: 'app-user-card', standalone: true, imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: ` <artic...
- 584 stars
- 0 votes
- 0 copies
- 5 views
- Added September 5, 2026
Works with
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-agent-skills-standard)# Creating a standalone Angular component
Declare the component with `standalone: true`, import every directive or component it uses in the component's `imports` array, and use `OnPush` change detection. With Angular's built-in control flow, simple interpolation and event binding do not require `CommonModule`.
```ts
import { ChangeDetectionStrategy, Component, input, output } from '@angular/core';
@Component({
selector: 'app-user-card',
standalone: true,
imports: [],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<article class="card">
<h2>{{ name() }}</h2>
<button type="button" (click)="selectUser()">Select</button>
</article>
`,
})
export class UserCardComponent {
readonly name = input.required<string>();
readonly selected = output<void>();
selectUser(): void {
this.selected.emit();
}
}
```
The parent can use it without declaring it in an NgModule:
```html
<app-user-card [name]="userName" (selected)="onUserSelected()" />
```
For a component that uses another standalone component or directive, add that dependency to `imports`. Keep service injection and state orchestration in a smart/container component; a presentational component such as this one should receive inputs and emit outputs only.
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.