Skip to content

anilsingh581/Angular-Interview-Questions-Answers-Examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

78e4d44 · Feb 26, 2025

History

31 Commits
Feb 25, 2025
Feb 26, 2025
Feb 25, 2025
Feb 26, 2025
Feb 25, 2025
Feb 25, 2025
Feb 25, 2025
Feb 25, 2025
Feb 25, 2025
Feb 25, 2025
Feb 25, 2025
Feb 25, 2025
Feb 25, 2025
Feb 25, 2025
Feb 26, 2025
Feb 25, 2025
Feb 25, 2025
Feb 25, 2025
Feb 25, 2025
Feb 25, 2025

Repository files navigation

Angular Interview Questions and Answers Examples

A curated list of common Angular interview questions with concise answers and examples.

Table of Contents

1. Core Concepts

Q: What is Angular and its key features?
A: Angular is a TypeScript-based framework for building dynamic web apps. Key features: two-way data binding, dependency injection, and component-based architecture.


2. Components & Templates

Q: How do you create a component in Angular?
A: Use @Component decorator with a selector, template, and styles. Example: ng generate component my-component.


3. Directives

Q: What are structural directives?
A: Directives like *ngIf and *ngFor that modify DOM structure. Example: <div *ngIf="isVisible">Content</div>.


4. Dependency Injection

Q: How does DI work in Angular?
A: Angular’s injector provides services to components. Example: constructor(private service: MyService) {}.


5. Routing

Q: How do you configure a route in Angular?
A: Define routes in RouterModule with path and component. Example: { path: 'home', component: HomeComponent }.


6. Forms

Q: What’s the difference between template-driven and reactive forms?
A: Template-driven uses directives in HTML; reactive uses FormGroup in TypeScript for more control.


7. HTTP Client

Q: How do you fetch data with HttpClient?
A: Inject HttpClient and use get(). Example: this.http.get('api/data').subscribe(data => console.log(data)).


8. RxJS

Q: What are Observables in Angular?
A: Streams of data handled asynchronously. Example: interval(1000).subscribe(val => console.log(val)).


9. Performance & Optimization

Q: How do you optimize Angular apps?
A: Use lazy loading, OnPush change detection, and Ahead-of-Time (AOT) compilation.


10. Testing

Q: How do you write a unit test for a component?
A: Use Jasmine/Karma. Example: it('should render title', () => { expect(component.title).toBe('MyApp'); }).

How to Run

  • Clone this repository:
    git clone [angular-interview-examples](https://github.com/anilsingh581/Angular-Components.git)
  • Navigate into the folder:
    cd angular-interview-examples
  • Install dependencies:
    npm install
  • Run the Angular application:
    ng serve

Releases

No releases published

Packages

No packages published