Angular · Components · Fresh / Intern · Concept
What is an Angular component and what are its core pieces?
Short Interview Answer
A component is a class with a template and styles that owns a piece of UI, declared with @Component.
Detailed Explanation
Angular components encapsulate view + logic. The decorator sets selector, template/templateUrl, styleUrls, and changeDetection. The class holds state and methods; the template binds to them. Standalone components import their own dependencies instead of needing NgModules.
Example
@Component({
selector: 'app-hello',
standalone: true,
template: `<h1>{{ title() }}</h1>`,
})
export class HelloComponent {
title = signal('Hello');
}