Interview Questions

AJAX Interview Questions Android Interview Questions Angular 2 Interview Questions AngularJs Interview Questions Apache Presto Interview Questions Apache Tapestry Interview Questions Arduino Interview Questions ASP.NET MVC Interview Questions Aurelia Interview Questions AWS Interview Questions Blockchain Interview Questions Bootstrap Interview Questions C Interview Questions C Programming Coding Interview Questions C# Interview Questions Cakephp Interview Questions Cassandra Interview Questions CherryPy Interview Questions Clojure Interview Questions Cobol Interview Questions CodeIgniter interview Questions CoffeeScript Interview Questions Cordova Interview Questions CouchDB interview questions CSS Buttons Interview Questions CSS Interview Questions D Programming Language Interview Questions Dart Programming Language Interview Questions Data structure & Algorithm Interview Questions DB2 Interview Questions DBMS Interview Questions Django Interview Questions Docker Interview Questions DOJO Interview Questions Drupal Interview Questions Electron Interview Questions Elixir Interview Questions Erlang Interview Questions ES6 Interview Questions and Answers Euphoria Interview Questions ExpressJS Interview Questions Ext Js Interview Questions Firebase Interview Questions Flask Interview Questions Flex Interview Questions Fortran Interview Questions Foundation Interview Questions Framework7 Interview Questions FuelPHP Framework Interview Questions Go Programming Language Interview Questions Google Maps Interview Questions Groovy interview Questions GWT Interview Questions Hadoop Interview Questions Haskell Interview Questions Highcharts Interview Questions HTML Interview Questions HTTP Interview Questions Ionic Interview Questions iOS Interview Questions IoT Interview Questions Java BeanUtils Interview Questions Java Collections Interview Questions Java Interview Questions Java JDBC Interview Questions Java Multithreading Interview Questions Java OOPS Interview Questions Java Programming Coding Interview Questions Java Swing Interview Questions JavaFX Interview Questions JavaScript Interview Questions JCL (Job Control Language) Interview Questions Joomla Interview Questions jQuery Interview Questions js Interview Questions JSF Interview Questions JSP Interview Questions KnockoutJS Interview Questions Koa Interview Questions Laravel Interview Questions Less Interview Questions LISP Interview Questions Magento Interview Questions MariaDB Interview Questions Material Design Lite Interview Questions Materialize CSS Framework Interview Questions MathML Interview Questions MATLAB Interview Questions Meteor Interview Questions MongoDB interview Questions Moo Tools Interview Questions MySQL Interview Questions NodeJS Interview Questions OpenStack Interview Questions Oracle DBA Interview Questions Pascal Interview Questions Perl interview questions Phalcon Framework Interview Questions PhantomJS Interview Questions PhoneGap Interview Questions Php Interview Questions PL/SQL Interview Questions PostgreSQL Interview Questions PouchDB Interview Questions Prototype Interview Questions Pure CSS Interview Questions Python Interview Questions R programming Language Interview Questions React Native Interview Questions ReactJS Interview Questions RequireJs Interview Questions RESTful Web Services Interview Questions RPA Interview Questions Ruby on Rails Interview Questions SAS Interview Questions SASS Interview Questions Scala Interview Questions Sencha Touch Interview Questions SEO Interview Questions Servlet Interview Questions SQL Interview Questions SQL Server Interview Questions SQLite Interview Questions Struts Interview Questions SVG Interview Questions Swift Interview Questions Symfony PHP Framework Interview Questions T-SQL(Transact-SQL) Interview Questions TurboGears Framework Interview Questions TypeScript Interview Questions UiPath Interview Questions VB Script Interview Questions VBA Interview Questions WCF Interview Questions Web icon Interview Questions Web Service Interview Questions Web2py Framework Interview Questions WebGL Interview Questions Website Development Interview Questions WordPress Interview Questions Xamarin Interview Questions XHTML Interview Questions XML Interview Questions XSL Interview Questions Yii PHP Framework Interview Questions Zend Framework Interview Questions Network Architect Interview Questions

Top 28 Angular 2 Interview Questions for 2022

1) What is Angular 2?

It is an open source JavaScript framework which is used to build web applications in JavaScript and HTML. It is also used to overcome obstacles encountered while working with Single Page applications.

2) What are the features of Angular 2?

Features of Angular 2 are:
  • Components: Helps in maintaining the application and to build the applications into many modules
  • TypeScript: TypeScript is a superset of JavaScript
  • Services: Set of code that can be shared by different components of an application

3) What are the components available in Angular 2?

The components available in Angular 2 are:
  • Modules
  • Component
  • Templates
  • Metadata
  • Service

4) What are the ways to get started with your first Angular JS application?

There are three ways to get started with your first application are:
  • Use scratch
  • Use the quick start at Angular Github
  • use Angular CLI

5)What is NgModule decorator?

NgModule decorator is used to define the declarations, imports and bootstrapping options.

6) What is Import and Export array?

Import array is used to import the functionality from other Angular JS modules. Export array is used to export directives, components and pipes.

7) What are the advantages of using Angular 2 over Angular 1?

Advantages of using Angular 2 over Angular 1:
  • Modular
  • Easy to Learn
  • Cross platform
  • Angular 2 is also a platform
  • Better Speed and Performance
  • ES6 and Typescript is also available

8) What are the lifecycle phases of Angular 2 application?

Lifecycle phases of Angular 2 application:
  • constructor
  • ngOnChanges
  • ngOnInit
  • ngDoCheck
  • ngAfterContentInit
  • ngAfterContentChecked
  • ngAfterViewInit
  • ngAfterViewChecked
  • ngOnDestroy

9) What is Routing in Angular 2?

Routing helps in enables user to navigate between views and components. Angular 2 simplifies routing and provide flexibility.

10) What is Date filter?

Date filter: It is used to convert the input string to date format.

11) What is Dependency Injection?

Dependency Injection: It is the ability to add the functionality of components at runtime.

12) What is CLI?

CLI stands for Command Line Interface, and it is used to create Angular JS application.

13) What are Angular 2 directives?

Commonly used filters are: It is a custom HTML element which is used to extend the power of HTML. Types of Angular 2 directives:
  • ngif
  • ngFor

14) Which components are used to configure routing in Angular 2?

Three main components are:
  • Routes
  • RouterOutlet
  • RouterLink

15) What are Modules in Angular 2?

Modules are used to put logical boundaries in your application. To separate the functionality of your application, you need to build everything into separate modules.

16) Which command is used to check the version of node.js in the command prompt?

The command used is: node -v.

17) Which command is used to install npm (node package manager)?

The command used is: npm install (inside Node.js command prompt).

18) What is TypeScript?

TypeScript: It is a superset of JavaScript which is used for application-scale development. TypeScript is also an object-oriented and compiled language.

19) What is Shadow Dom in Angular2?

Shadow Dom: It refers to a subtree of DOM elements which is the part of the document, but not into the main document of DOM tree. Here, the Shadow Dom is created when we are creating a component in Angular2.

20) What is Codelyzer in Angular2?

Codelyzer: It is an open source tool which is used to check whether the pre-defined coding guidelines has been followed or not.

21) What are Event Emitters in Angular2?

Event Emitters: It is a class defined in @angular/core module which is used by components and directives to emit custom events.

22) What is npm?

npm stands for node package manager. npm is a command line utility that interacts with a repository of open source projects. We can install packages, libraries and applications, along with their dependencies by using npm.

23) What is PrimeNG in Angular2?

PrimeNG: It is a collection of UI components for Angular2. It is a sibling of the popular JavaServer Faces Component Suite, PrimeFaces.

24) What is ECMAScript?

ECMAScript: It is scripting language which is used for writing server applications and services using Node.js.

25) What is Traceur in Angular2?

Traceur: It is a JavaScript compiler. This compiler is used to compile ES6 code into ES5 code. Traceur compiler supports ES5 and ES6.

26) What is ngIf in Angular2?

ngIf: It is a directive element of Angular2 that is used to add elements to the HTML code if it evaluates to true, else it will not add the elements to the HTML code.

27) Which method is used to initialize the component’s views and child views in lifecycle?

ngAfterViewInit() method.

28) What is ngAfterViewChecked() in Angular2 lifecycle?

ngAfterViewChecked(): This method is used to checks the component's views and child views.