AngularAngularbeginner

Angular Interview Questions for Freshers

25 Angular questions for front-end fresher roles: components, NgModule vs standalone, the four kinds of data binding, directives, pipes, services, dependency injection, routing and HttpClient, with short answers.

Published
TL;DR – Quick Answer

Angular fresher interviews focus on components, modules and standalone components, the four kinds of data binding, directives, services with dependency injection, and routing. Prepare a short definition and a small code example for each, and be able to explain how a parent and child component share data.

On This Page

Angular interview questions for freshers test whether you understand how an Angular app is built from components and services. Expect questions on components, modules, data binding, directives, services and routing. This page has 25 questions with short answers and small code examples.

Examples use recent Angular, where new projects use standalone components. Where older NgModule code works differently, the answer says so.

How to answer Angular interview questions

Answer with what it is, a two-line example and where you used it. "Property binding sets an element property from component data. [disabled]="isSaving" disables the button while a form is saving. I used it on my project's login form."

Pro tip: Angular interviews often ask you to explain your own project's folder structure. Be ready to say what each component and service does.

Angular basics questions

Q1. What is Angular?

30-second answer: Angular is a TypeScript-based front-end framework from Google for building single-page applications. It includes components, routing, forms, an HTTP client and dependency injection, so most things a large app needs are built in.

Q2. What is the difference between Angular and AngularJS?

Point AngularJS (1.x) Angular (2 and later)
Language JavaScript TypeScript
Building block Controllers and $scope Components
Mobile support Limited Designed with mobile in mind
Status Long-term support ended in 2021 Actively developed

30-second answer: Angular is a complete rewrite of AngularJS, not an upgrade. They share a name but very little code.

Q3. What is a single-page application?

30-second answer: A single-page application (SPA) loads one HTML page and then updates the view with JavaScript as the user moves around, instead of loading a new page from the server each time. Angular's router changes the URL and swaps components without a full reload.

Q4. Which Angular CLI commands do you use?

Command Does
ng new my-app Create a new project
ng serve Run a development server, usually at port 4200
ng generate component user-list Create a component (ng g c for short)
ng generate service user Create a service
ng build Build the app for deployment
ng test Run unit tests

30-second answer: The CLI creates projects and files with the right structure, runs the app and builds it for production.

Q5. What happens when an Angular app starts?

30-second answer: The browser loads index.html, which contains the root element such as <app-root>. main.ts calls bootstrapApplication(AppComponent, appConfig) in a standalone app, or bootstrapModule(AppModule) in an NgModule app. Angular then renders the root component, and the router loads the component for the current URL.

Component and module questions

Q6. What is a component?

30-second answer: A component controls a part of the screen. It has a TypeScript class for data and logic, an HTML template and optional styles. The @Component decorator links them and sets the selector used as a tag.

import { Component } from '@angular/core';

@Component({
  selector: 'app-greeting',
  template: `<h2>Hello, {{ name }}!</h2>`,
})
export class GreetingComponent {
  name = 'Asha';
}

Using <app-greeting></app-greeting> shows "Hello, Asha!".

Q7. What is an NgModule?

30-second answer: An NgModule groups related components, directives and pipes, and lists what they need. declarations lists the module's own components, imports brings in other modules, providers registers services and bootstrap names the root component in the main module.

@NgModule({
  declarations: [AppComponent, UserListComponent],
  imports: [BrowserModule, FormsModule],
  bootstrap: [AppComponent],
})
export class AppModule {}

Q8. What is a standalone component?

30-second answer: A standalone component does not belong to an NgModule. It lists what it needs in its own imports array. Since Angular 17, ng new creates standalone components by default, and since Angular 19 components are standalone unless you set standalone: false.

@Component({
  selector: 'app-search',
  imports: [FormsModule],
  template: `<input [(ngModel)]="term" /> <p>{{ term }}</p>`,
})
export class SearchComponent {
  term = '';
}

Q9. What is the difference between a component and a module?

30-second answer: A component is one piece of the screen with a template. A module is a container that groups components and other code and controls what they can use. Newer apps often skip modules and let each standalone component import what it needs.

Q10. What are lifecycle hooks?

Hook Runs
ngOnChanges When an input value changes, before ngOnInit the first time
ngOnInit Once, after the first inputs are set
ngAfterViewInit Once, after the component's view is ready
ngOnDestroy Just before the component is removed

30-second answer: Hooks let you run code at set points in a component's life. Use ngOnInit to load data, not the constructor, and ngOnDestroy to clean up subscriptions and timers.

Data binding questions

Q11. What is data binding? What are its types?

Type Syntax Direction
Interpolation {{ name }} Component to view
Property binding [src]="photoUrl" Component to view
Event binding (click)="save()" View to component
Two-way binding [(ngModel)]="email" Both ways

30-second answer: Data binding keeps the template and the component class in sync. The brackets tell you the direction: square for data in, round for events out, both for two-way.

Q12. What is the difference between interpolation and property binding?

30-second answer: Interpolation puts a value into text, as in <p>{{ name }}</p>. Property binding sets a DOM property, as in <button [disabled]="isSaving">. For text both work, but property binding is needed for non-string values such as booleans.

Q13. How does two-way binding work?

30-second answer: [(ngModel)] combines property binding and event binding. It needs FormsModule in the component's or module's imports.

<input [(ngModel)]="email" />
<p>You typed: {{ email }}</p>

As the user types, email updates, and if the code changes email, the input updates. The syntax [( )] is called "banana in a box".

Q14. How do parent and child components share data?

30-second answer: The parent passes data down with an input and the child sends events up with an output.

// child
export class RatingComponent {
  @Input() stars = 0;
  @Output() rated = new EventEmitter<number>();
  rate(n: number) { this.rated.emit(n); }
}
<!-- parent template -->
<app-rating [stars]="4" (rated)="onRated($event)"></app-rating>

Newer code can use the input() and output() functions instead of the decorators. They do the same job.

Directive and pipe questions

Q15. What are directives? What types are there?

30-second answer: Directives add behaviour to elements. Components are directives with a template. Structural directives change the layout by adding or removing elements, such as *ngIf and *ngFor. Attribute directives change how an element looks or behaves, such as ngClass and ngStyle.

Q16. How do you show a list and a condition in a template?

@if (students.length > 0) {
  <ul>
    @for (s of students; track s.id) {
      <li>{{ s.name }}</li>
    }
  </ul>
} @else {
  <p>No students yet.</p>
}

30-second answer: Recent Angular has built-in control flow with @if, @for and @switch. Older code uses *ngIf and *ngFor, such as <li *ngFor="let s of students">. track tells Angular how to identify each item so it updates the list efficiently.

Q17. What are pipes?

30-second answer: Pipes format values in a template without changing the data. Built-in pipes include date, uppercase, lowercase, currency, percent, json and async.

<p>{{ joinedOn | date:'dd/MM/yyyy' }}</p>
<p>{{ fee | currency:'INR' }}</p>

You can write your own pipe with the @Pipe decorator and a transform method.

Service and dependency injection questions

Q18. What is a service, and why use one?

30-second answer: A service is a class that holds logic or data shared across components, such as API calls, login state or a cart. Keeping this out of components makes them smaller and easier to test.

@Injectable({ providedIn: 'root' })
export class CartService {
  private items: string[] = [];
  add(item: string) { this.items.push(item); }
  count() { return this.items.length; }
}

Q19. What is dependency injection?

30-second answer: Dependency injection means a class asks for what it needs and Angular supplies it, instead of the class creating it with new. providedIn: 'root' makes one shared instance for the whole app.

export class HeaderComponent {
  private cart = inject(CartService);   // or: constructor(private cart: CartService) {}
}

This makes testing easy, because a test can provide a fake service.

Q20. How do you call an API in Angular?

30-second answer: Use HttpClient, registered with provideHttpClient() in the app config. Its methods return Observables, which run when you subscribe or use the async pipe.

@Injectable({ providedIn: 'root' })
export class UserService {
  private http = inject(HttpClient);
  getUsers() {
    return this.http.get<User[]>('/api/users');
  }
}

Q21. What is an Observable?

30-second answer: An Observable, from the RxJS library, is a stream of values over time. You subscribe to receive values. HTTP calls, form value changes and router events are Observables in Angular. Unsubscribe from long-lived streams, or use the async pipe, which unsubscribes for you.

Routing and forms questions

Q22. How does routing work in Angular?

export const routes: Routes = [
  { path: '', component: HomeComponent },
  { path: 'courses/:id', component: CourseDetailComponent },
  { path: '**', component: NotFoundComponent },
];

30-second answer: Routes map URL paths to components and are registered with provideRouter(routes). <router-outlet> marks where the routed component appears, and routerLink="/courses/5" creates a link without a page reload. ** catches unknown URLs. Read route parameters with ActivatedRoute.

Q23. What is lazy loading?

30-second answer: Lazy loading downloads a part of the app only when the user visits its route, which makes the first load faster.

{ path: 'admin', loadComponent: () => import('./admin/admin.component').then(m => m.AdminComponent) }

NgModule apps use loadChildren to lazy-load a module or a set of routes.

Q24. What is a route guard?

30-second answer: A guard decides whether navigation can continue, such as blocking /dashboard for users who are not logged in. Recent Angular uses functions such as CanActivateFn added to a route's canActivate list. Remember that guards only protect the screen; the server must still check permissions.

Q25. What is the difference between template-driven and reactive forms?

Point Template-driven Reactive
Defined in The template, with ngModel The class, with FormGroup and FormControl
Module FormsModule ReactiveFormsModule
Best for Simple forms Larger forms with complex validation
Testing Harder Easier

30-second answer: Template-driven forms are quick for small forms. Reactive forms give more control and are common in company projects.

Quick revision table

Topic One line to remember
Component Class plus template plus selector
NgModule Groups components; older default
Standalone Component imports what it needs; new default
Binding {{ }}, [ ], ( ), [( )]
@Input / @Output Parent to child / child to parent
Directive Adds behaviour; structural or attribute
Pipe Formats a value in the template
Service Shared logic, injected with DI
Router URL to component, <router-outlet>

How to prepare in one week

Day Task
1 TypeScript basics and Angular CLI
2 Components, templates and data binding
3 Inputs, outputs and lifecycle hooks
4 Directives, control flow and pipes
5 Services, DI and HttpClient
6 Routing, lazy loading and a reactive form
7 Revise and do a mock interview

Angular is built on TypeScript, so revise the TypeScript interview questions for freshers before the round. Many Angular projects style pages with Bootstrap through ng-bootstrap, so the Bootstrap interview questions for freshers are worth a quick read too. If you are still choosing a framework, read React vs Angular.

Frequently Asked Questions

Should I learn TypeScript before Angular?
Learn the basics first: types, interfaces, classes and decorators at a reading level. Angular is written in TypeScript and every component is a TypeScript class, so weak TypeScript makes Angular harder than it needs to be.
Do interviewers still ask about NgModule?
Yes. New projects use standalone components by default, but many company codebases still use NgModule. Know what each is, how a standalone component imports what it needs, and how an NgModule declares components.
Is Angular or React better for a fresher job?
Both have many openings. Angular is common in large enterprise and service-company projects, while React is common in product companies and start-ups. Check the job posts in your target city and pick one to learn well.
Which Angular version should I mention in an interview?
Mention the version you used in your project, and know that recent versions use standalone components, the built-in control flow such as @if and @for, and signals. Check the official Angular site for the current release.
What Angular project should I build before an interview?
Build a small app with three or four routed pages, a service that calls a public API with HttpClient, a form with validation and a parent-child component pair that passes data both ways. Put it on GitHub with a README.
Siva Prasad Galaba
Founder, CodeBegun · Staff Engineer

Founder of CodeBegun. 15+ years building Java systems at companies like Crunchyroll. Teaches Java, Spring Boot and system design the way the industry actually works, and mentors students through projects, mock interviews and placement preparation.

Technically reviewed by CodeBegun Technical TeamLast reviewed 5 December 2026 LinkedIn
Chat with us