20 Angular Interview Questions You Must Know in 2024
4 min readNov 30, 2024
1. What is Angular?
Answer:
Angular is a TypeScript-based open-source framework by Google for building single-page web applications (SPAs).
2. What are the components in Angular?
Answer:
Components are the basic building blocks of Angular applications.
Code Example:
@Component({
selector: 'app-root',
template: `<h1>Welcome to Angular</h1>`,
})
export class AppComponent {}
3. How does two-way data binding work?
Answer:
Two-way binding allows data synchronization between the component and the view. Use [(ngModel)].
Code Example:
<input [(ngModel)]="name" placeholder="Enter name">
<p>Hello, {{ name }}</p>
4. What are directives in Angular?
Answer:
Directives are instructions for the DOM. Common types are:
- Structural Directives: e.g., *ngIf, *ngFor.
- Attribute Directives: e.g., ngClass, ngStyle.
Code Example:
<div…