Angular 2 Interview Questions and Answers

Angular 2 interview questions

These Angular 2 questions have been designed for various interviews, competitive exams and entrance tests. We have covered questions on both basic and advanced concepts which will help you improve your skills to face interview questions on Angular 2.

Who is this Angular 2 interview questions designed for?

All the Web developers, Front End developers, UI/ UX developers and designers will find these questions extremely useful. All freshers, BCA, BE, BTech, MCA and college students wanting to make a career in front end designing will be highly benefitted by these questions.

Angular 2 interview questions topics

This section covers Angular 2 topics like - Angular 2 Modules, Architecture, Components, Templates, Directives, Metadata, Data Binding, Error Handling, Routing, Navigation, Forms, CLI, Dependency Injection, Advanced Configuration, Handling Events, Transforming Data, Custom Pipes, User Input, Services etc.

1. What is Angular 2?


Angular 2 is a JavaScript framework for developing desktop as well as mobile application. It is an open source framework which is built by the developer at Google. Angular 2 helps us to develop web application in HTML and JavaScript. It follows simpler, faster and modular design approach.

Angular 2 framework is written in ECMAScript 6 (ES6). The ES6 compiler manages the versioning related problem.

2. What are the advantages of using Angular 2 over Angular JS?


Following are the advantages of using Angular 2 over Angular JS:

  • Angular JS uses only JavaScript but Angular 2 provides the possibility to use different languages like TypeScript, ES5, ES6, Dark etc.
  • Angular JS was not built with mobile support in mind, where Angular 2 is mobile oriented.
  • Angular 2 based on components, and it provides better performance than Angular JS.
  • The use of dependency injection is enhanced in Angular 2.
  • Angular 2 has the flexible routing with lazy loading features.
  • Angular 2 is faster

3. What is routing in Angular 2?


Routing in Angular 2 is a mechanism for navigating between pages and displaying an appropriate component/page on browser. The Router helps mapping application URL to application components.  

Following are some of the main components used to configure routing:

  • Routes
  • Router Imports
  • RouterOutlet
  • RouterLink

4. What is Module in Angular 2?


In Angular 2, Module allows to put logical boundaries in our application. It is a fundamental feature of Angular 2 that groups related components, directives, pipe and services together.

Every Angular 2 application has at least one module, the root module, conventionally named AppModule. Some important features like lazy loading are done at the Angular Module level.

5. What is Component in Angular 2?


In Angular 2 application everything is component. Components are a logical piece of code for Angular JS application. Each component is mainly used to build HTML elements and provides logical boundary of functionality for the Angular 2 application. The components encapsulate all the logic, allowing you to reuse them across your application.

A Component consists of the following:

Template: It is used to render the view for the application.

Class: It is like any class of c and c++

Metadata: It has the extra data defined for the Angular class. It is defined with a decorator.


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

@Component ({
   selector: 'Home',
   template: ` <div>
      <div>To Home Page</div>
   </div> `,

export class HomeComponent {
   homeTitle: string = 'Welcome';