Back to Interview Prep

Angular Interview Questions - Angular Interview Prep

50 Questions Available

Comprehensive collection of 50 essential Angular interview questions covering components, services, routing, directives, and Angular best practices.

All Questions & Answers

Show per page:
1

What is Angular?

A

Angular is TypeScript-based web framework for building single-page applications (SPAs). Features: component-based architecture, dependency injection, routing, two-way data binding, directives, services, RxJS for reactive programming. Developed by Google.

2

What is the difference between AngularJS and Angular?

A

AngularJS (v1.x) uses JavaScript, controllers, scope, two-way binding. Angular (v2+) uses TypeScript, components, no scope, one-way binding by default, better performance, mobile support, modern architecture. Angular is complete rewrite, not upgrade.

3

What is a component in Angular?

A

Component is building block of Angular app. Consists of: class (TypeScript), template (HTML), styles (CSS), metadata (@Component decorator). Encapsulates data, logic, and view. Reusable, composable. Root component bootstraps application.

4

What is a module in Angular?

A

Module (@NgModule) organizes application into cohesive blocks. Declares components, directives, pipes. Imports other modules. Exports for other modules. Provides services. Root module (AppModule) bootstraps app. Feature modules organize by feature.

5

What is data binding in Angular?

A

Data binding connects component data with template. Types: interpolation {{ }}, property binding [ ], event binding ( ), two-way binding [( )]. One-way by default (component to view). Two-way requires FormsModule. Enables dynamic UI updates.

6

What is a directive?

A

Directive modifies DOM or component behavior. Types: component (with template), structural (*ngIf, *ngFor), attribute ([ngClass], [ngStyle]). Structural directives change DOM structure. Attribute directives change appearance/behavior. Can create custom directives.

7

What is a service in Angular?

A

Service is class with specific purpose, provides functionality to components. Injectable via dependency injection. Singleton by default (one instance per injector). Uses: data fetching, business logic, shared state, logging. Created with @Injectable decorator.

8

What is dependency injection?

A

Dependency injection provides dependencies to classes rather than creating them. Angular creates and manages instances. Benefits: testability, maintainability, loose coupling. Inject via constructor. Configure in providers array or providedIn: root.

9

What is routing in Angular?

A

Routing enables navigation between views. Configure routes in Routes array. RouterModule provides router directives and service. Use routerLink for navigation, router-outlet for displaying routed components. Supports lazy loading, guards, parameters.

10

What are Angular lifecycle hooks?

A

Lifecycle hooks are methods called at specific points in component lifecycle. Order: ngOnChanges, ngOnInit, ngDoCheck, ngAfterContentInit, ngAfterContentChecked, ngAfterViewInit, ngAfterViewChecked, ngOnDestroy. Implement OnInit, OnDestroy most commonly.

Showing 1 to 10 of 50 questions
...