TOP 20 Angular Question Answer

In this article, we will see Angular interview question with answer.Because it is very demanding in the market. It is very useful for experienced and fresher both.But some software developers think that it is only for Angular 2, but it is very important for Angular 2,4,5,6,7 and 8, means any version of Angular like Angular 2+.



Let's start,
1. Question: What is Angular?
Answer: Angular is a TypeScript-based open-source web application framework,developed and maintained by Google. It offers an easy and powerful way of building front end web-based applications.
Angular integrates a range of features like declarative templates, dependency injection, end-to-end tooling, etc. that facilitates web application development.
2. What is Typescript?
Answer:  Typescript is a Superset of JavaScript meaning any JavaScript code is valid typescript code.Typescript is Trans piled to JavaScript behind the scene in the IDE.
Typescript allows us to use generic programming (classes and modules). Typescript follows the ECMAScript 2015 standard which contains features like:
A.  Generic
B.  Namespaces
C. Enumerated type
D. Interfaces

3. What is NPM and why do we need it?
Answer:  Npm stands for the Node package manager. It is an online repository and works as a package manager for JavaScript.
A package.json file in our application defines the dependencies that we want to download for our application.

4. Explain Components in Angular 2?
Answer: In angular, a Component is a special type of directive in angular 2+ that uses a simpler configuration,which is suitable for a component-based application structure. It should only one or more than one in an application.It is consists of three things, they are as given below.

A. Class − This is like a C or Java class which consists of properties and methods.
B. Template − This is used to define the HTML view which is displayed in the application.
C. Metadata − This is used to decorate the class and extend the functionality of the class.
5. How many types of the directive and explain it?
Answer:
There are three types of the directive.
A. Component Directive
B. Structural Directive
C. Attributes Directive
Let's start one by one.
1. Component Directive: It is also a type of directive with template, style and logic part which
is a very famous directive. We can't create any angular application without it.
It is at least one in an angular application.
2. Structural Directive:
Answer: It is responsible for the HTML layout. It changes the shape or reshapes the HTML view by simple adding
or removing the element in the DOM. Structural directives are given below.
A. NgIf (*ngIf)
B. NgFor (*ngFor)
C. NgSwitch (ngSwitch)

3. Attributes Directive: It is a way to modify the appearance of the DOM element or component.
Answer:
There are two types of build in the directive.
A. NgStyle: Angular provides a built-in NgStyle attribute to modify the element appearance.
B. NgClass: This attribute is used to change the class attribute of the element in DOM or component which it has attached.
6. What are directives in Angular?
Answer:
A core feature of Angular, directives are attributes that allow you to write new HTML syntax, specific to your application.
They are essentially functions that execute when the Angular compiler finds them in the DOM. The Angular directives are segregated into 3 parts:
  1. Component Directives
  2. Structural Directives
  3. C.Attribute Directives
7. Name the building blocks of Angular.
Answer:
The Angular application is made using the following:

A. Modules
B. Component
C. Template
D. Directives
E. Data Binding
F. Services
G. Dependency Injection
H. Routing
8. Can you tell me those browsers which are supported by angular 2+?
Answer:
A. Google Chrome
B. Firefox
C. Edge
D. IE for versions 9-11
E. Safari
F. iOS 7.1
G. Android 4.1
H. IE Mobile
9. What is AOT?
Answer: AOT stands for Ahead of Time. It is the compilation in which Angular compiles the components and templates to JavaScript and HTML while developing
10. What is Event Emitors?
Answer: It is a special type of class defined in a core module that can be used by components and directives to emit custom events.
11. What is an event & it's type in Angular?
Answer: Events in Angular are specific directives that help in customizing the behavior of various DOM events. Some events are given below.
A. ng-click
B. ng-copy
C. ng-cut
D. ng-dblclick
E. ng-keydown
F. ng-keypress
G. ng-keyup
H. ng-mousedown
I. ng-mouseenter
J. ng-mouseleave
K. ng-mousemove
L. ng-mouseover
M. ng-mouseup
N. ng-blur
12. Tell me some testing tools for angular application?
Answer:
A. Karma
B. Angular Mocks
C. Mocha
D. Browserify
E. Sion
13. Question: What is Trans-piling in Angular?

Answer: Trans-piling means converting the source code from one programming language into another programming language.
It means it over the TypeScript into JavaScript.
14. Is angular 2 Object-Oriented?
Answer: Yes, Angular 2 is a true object-oriented development framework.
15. What is CLI?
Answer:  CLI is the acronym of Command Line Interface, which can be used to create the Angular JS or angular application.Using CLI.
16. What is the directive?
Answer: Directive are the elements that change the appearance or behavior of the DOM
element.
17. What is a module?
Answer: Modules are logical boundaries in your application and the application is divided into separate modules to separate the functionality of your application.
18. In Angular, how can you interact between Parent and Child components?

Answer: When passing data from Parent to Child component, you can use the @Input decorator in the Child component. When passing data from Child to Parent component, you can use the @Output decorator in the Child component.
19. Does Angular support nested controllers?
Answer: 
Yes, Angular does support the concept of nested controllers. And it needs to be defined in a hierarchical manner for using it ,in the View. 
20. What are Angular expressions?
Answer: It is very special type of expression which placed/binding the values such as {{ expression }} similar to JavaScript.
It is used to bind application data into HTML.
Syntax: {{ expression }}
I hope it will for all of you.

No comments

Powered by Blogger.